Jump to content

How to spawn prefabs rotated in random but defined angle segments?


carc
Go to solution Solved by Peter,

Recommended Posts

Hi there!

I am spawning prefabs, which need to be placed in random rotation, but that rotation needs to only be allowed in 90 degree segments. So I have, say, 10 sewer models on the road on a straight spline and I need each of them being randomly rotated with 90 degrees definitzion. So, the first one would be rotated at 0 degrees, the second one at 270, the next one at 90 etc etc. Thanks for any tips in advance!

Link to comment
Share on other sites

  • Solution

Hi @carc, you can use the "One Child of" decorator to create a prefab that will spawn one of those rotations for you. To do so, create a prefab that has 4 instances of the sewer model as childs with the preferred rotation, and use the "One Child of" component at the root, like so:

image.png

Make sure "Destroy after spawn" and "Unpack Prefab" are checked. If you then ingest this prefab for spawning in GeNa, you will get a random 90° direction each time. Make sure to deactivate the rotation of the GeNa Spawner itself though, else it will be applied additionally to the "fixed" rotation from the prefab.

image.png

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...