Multi loft controller
Mega shapes is great for building up a race track, but in order to achieve good performance with reasonable quality you need to subdivide the track into sections so the whole track mesh is not drawn always.
You can do this by exporting the geometry and breaking it down in a 3D modelling software and then reimport to unity. This approach works but its less than ideal.
My suggestion is to create a multi loft controller that creates n lofts and lets you control them as if they are 1. So when you change cross params and such they get applied to all the children taking into account that they are part of a whole.
I've actually began to implement such control and so far its very promising, but I'd like a built in solution so I don't have to maintain it myself and merge my changes whenever megashapes is updated.
I could send my code if you would like to evaluate it.
-
nicholasclaygolden commented
And you don't have to import into 3d modeling software, use the 'distance' on the loft to get the detail on per section. straight sections I go with 1 distance, curvy sections get like .50 or something, since I have 4 sections (I've also done 8) you can still have things look pretty but do everything in unity rather than go outside and do blender, maya etc.
nick
-
nicholasclaygolden commented
I figured this out. Here is how you do get performance. I get 60fps on a 4s...
Make a path, make a cross section, make a loft. Then, make 4 more lofts (right click and create them don't duplicate - that doesn't work at least for me). Make sure EACH loft uses the same path. Make each section .25 in length, and have a start position of 0 for the first one. Then second loft same thing, length .25 and start position of .25, and so on. Each start position would be 0,.25,.50 and .75.
Adjust them how you want, at first I put different colors on them so I can see the ends to line them up. In the end you'll have 4 sections all using the same path. NOW, you can click off the mesh renderer on the original loft and now your object will follow the entire track using 4 SEPARATE lofts.
Then those lofts are handled either through poolmanager or occclusion culling.
Hit me up on twitter @nicholasgolden if you have questions about this method. It works great.
Then you use unity occlusion culling (only in pro) and set it up so these tracks are part of the group. -
nicholasclaygolden commented
I use a pool manager for the objects on the track don't get instantiated. If you draw them all at once, yea it's gonna suck. You can use culling and tags what not, but using a pool manager helped me 80% better performance (basically, draw only what the player can see in that camera).
The multi loft - yes, I would LOVE to be able to build one large track, then use the cursor to 'split' the section off, then I could add that to an array and perhaps deactivate it once I pass it or only instantiate what the player can see.
There are some good ideas you got there, I get what You want. I want that too.