Jump to content

Baked Road On Terrain Not Moving With Terrain When Repositioned


Daggy

Recommended Posts

Hi,

I'm pretty new to Gaia and GeNa but I feel like I'm trying to do something fairly simple and I can't figure out why I am getting strange behaviour.
I am trying to make a procedural road driving game where I have terrain prefabs with various road configurations on them and then spawn them in at runtime and position them according to the random. This requires repositioning the terrain pieces (each one is 200 x 200). I have baked the road to the terrain and it has added the children under the terrain but for some reason when I move the terrain it is moving the road but not equally, as if there is an offset of some kind. I've been trying to figure out where that is coming from and have reached my wits end with it. If I attach a cube it moves perfectly with the terrain. Any ideas?

Link to comment
Share on other sites

So made a discovery but not the solution yet. So its definitely related to using the GeNA_Road_LitBasic_URP material. If I select the GeNa_URP_Road_Material for the mesh renderer the road stays relative to the parent terrain when the terrain is moved. I guess I can just use this material instead but still strange why the other material behaves the way it does.

Link to comment
Share on other sites

But now there is a new issue and clearly I just don't understand how GeNa works. I made a prefab from the terrain with the childed road and I have a script instantiate the prefab into the scene on start. The gameobject hiearchy is correct but the road is not visible on the terrain at all. What am I missing here?

Link to comment
Share on other sites

Have you looked at the RaceTrackMaker.cs example in the ScriptExamples of Gena?

You can bake the road after it is complete and parent the result to the terrain.

 

Link to comment
Share on other sites

Hmm, now that I tried what you last talked about, The meshes are missing from the RoadMesh Game Objects in a prefab created from the terrain (with Baked_RoadMeshes).
Perhaps you'll need to save the meshes as an asset in each RoadMesh and use those, then the prefab should work when created from them.

 

Edit:  You can use the FBX Exporter to save the meshes and materials for the baked roads.

Link to comment
Share on other sites

That sounds like a solution that would work. I also worked out another way. I added empty gameobjects as reference points on my terrain and I am now using the API to build the roads when the terrain is generated. This has so far been a solution I can work with. Thanks for the optional fix though I will keep that in mind if I see something like this in the future.

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
  • 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...