I’m looking to recreate the this type player trail as in the old Tron game except in 3D.
I want my game characters to leave a trail that can collide with other game objects.
What approach should I take to doing this?
On a separate note, is this in the right group or should I be posting this in game design?
Thanks
Well there are two problems to solve here.
One is how to make the geometry. Rudimentarily you can just emit an endless series of quads (one for left, one for right) and texture them properly. Ideally you would make some kind of geometry-producer that creates a fan of quads out the back of your bike. Unity makes procedural generation like this super-easy, just google around a bit.
The other problem is the collision. You could just feed whatever mesh/meshes you make in the above step into a MeshCollider object (or objects) and call it a day. But a better approach might be to put a thin long vertical box collider around each “segment” of line and grow it until the player turns, then make a new one on the new leg direction.
Thanks for the help.
Do you think that quad technique would still work if my players weren’t moving in straight lines? Would a circle be better? My player will be free roaming.
(Does the above work for 3D then?)
Should do. Take a look at how the Unity TrailRenderer produces geometry out the back of itself: make an object, put a trailrenderer on it, drag the object around to lengthen the trail, then turn the Scene view into “wireframe” mode and look at the generated geometry.
That geometry also has the property that it faces the camera all the time (something you (probably) do not want), but it will give you an idea of how an endless fan of quads can be generated behind a moving object, regardless if the object is curving or going straight.
Excellent, thanks. I’ll go and look into it!