Jump to content

Gena terrain texture - I want to control the rotation


Mick129
 Share

Go to solution Solved by Mick129,

Recommended Posts

At runtime, I want to spawn some objects and the player will control the rotation (this will texture the terrain. I was thinking about using Gena Pro to achieve this easily but I can't manage to set the rotation of the object via code. Any suggestion on how to achieve this?

 

image.thumb.png.2007901bdf52a5f1cfad94fe0e5201a9.png

Link to comment
Share on other sites

Hi @Mick129!

It is indeed possible to control the rotation of the Spawns you make with GeNa at runtime!
The solution is to get a reference to the Spawner Data at runtime and change the Rotation Y before spawning.

I don't know if you've seen this yet, but we actually have a demo of how to use the Spawner Data system in the following directory of GeNa: Procedural Worlds > GeNa > Asset Samples > Script Examples > GeNaRuntimeExample.cs
image.png

There is a function that demonstrates the modification of the Spawner Data between spawns:
image.png

It may look a bit complicated but that's only due to the fact that GeNa does so much and there's a lot of configurations that can be made. So it's necessary to modify it this way. That being said, there are a few ways to modify orientation of spawns. 

The first is to modify the 'data.RotationY' value which controls the orientation of root prototypes.
The other is to set the Placement Criteria's Rotation Algorithm to 'Fixed' and set both Min + Max to the rotation you want.
A demo of these can be found here:
image.png

Good luck and let me know if this helped in any way! 😁

Link to comment
Share on other sites

Thank you!

Yes I saw the video and the demo, what particular in my situation is that I have a saving system and I wanted to implement a solution that doesn't require to save all the terrain's texture. Since I place a GameObject (this will be the texture spawner) and that this gameObject's transform is saved, I was thinking about using it data for the placement/rotation and then paint the terrain on Start() when the player load the game.

Link to comment
Share on other sites

Oh and the last bit of code seems close to what I need, tonight I will explore in that direction. 
Thanks again 🙂

Link to comment
Share on other sites

17 hours ago, Manny said:

Hi @Mick129!

It is indeed possible to control the rotation of the Spawns you make with GeNa at runtime!
The solution is to get a reference to the Spawner Data at runtime and change the Rotation Y before spawning.

I don't know if you've seen this yet, but we actually have a demo of how to use the Spawner Data system in the following directory of GeNa: Procedural Worlds > GeNa > Asset Samples > Script Examples > GeNaRuntimeExample.cs
image.png

There is a function that demonstrates the modification of the Spawner Data between spawns:
image.png

It may look a bit complicated but that's only due to the fact that GeNa does so much and there's a lot of configurations that can be made. So it's necessary to modify it this way. That being said, there are a few ways to modify orientation of spawns. 

The first is to modify the 'data.RotationY' value which controls the orientation of root prototypes.
The other is to set the Placement Criteria's Rotation Algorithm to 'Fixed' and set both Min + Max to the rotation you want.
A demo of these can be found here:
image.png

Good luck and let me know if this helped in any way! 😁

So indeed I missed the Save and load part, thanks for that and the code made sense to me.
One thing that I am not sure to understand is why the result is clamped between -1 and 1?

You can see in the video above, I am supposed to use the gameObject's Y rotation as the min/max value (the result is the same with the commenter code) and at runtime you can see a slight different when I rotate but not more. I feel like I am close, but not there yet 🙂

In the video below you can see a small change on the second 7.

image.thumb.png.45182ae930489e422f1a68f07973e276.png

Edited by Mick129
Link to comment
Share on other sites

  • Solution

The last video made me think about the rotation which reminded me of eulerAngles.y.

Here the solution in case it can help someone else!

Thanks again for leading me to the right direction :).

 

image.thumb.png.8e6ceb7394b0e900ad8364e145abfa55.png

Edited by Mick129
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Tell a friend

    Love Unity 3D World & Game Creation Tools - Canopy - Procedural Worlds? Tell a friend!
  • Interesting Articles

    1. 2

      I'm getting tired of doing islands and craters

    2. 2

      I'm getting tired of doing islands and craters

    3. 1

      Problems with latest Gaia Update

    4. 1

      Adding shoreline or waterline effects, beaches, river banks, etc.

    5. 1

      Just upgraded my Canopy to Pro

×
×
  • Create New...