Skip to content

Track Mesh Generation

Harry Bosch edited this page Aug 21, 2023 · 1 revision

Asset Management

Mesh assets are saved and stored in the same directory of the trackMesh’s scene, in ${Scene Directory}/${Name of Scene}/${Name Of Spline}/Track Mesh.${Renderers Hash Code}.asset

When a mesh is re-baked, the old assets are deleted and replaced with new ones.


Generation

An endPoint value is walked along the track at a set increment, when a certain length around the spline has been reached, a mesh segment is added to the buffer. This mesh segment is deformed along its z position, interpolating the position and orientation of the two end points of the track.

After every n segment are added, the appended mesh data is split off and placed into a seperate object, allowing for proper frustum culling.


Hierarchy Organization

As meshes are split up into segments, they are places in mesh renderer objects, which are children of the TrackMesh component.


Development Issues

The finalized track meshes used to be stored in the scene, and were not disposed properly. This lead to a leak that was difficult to find and slow to happen, resulting in scene files being several orders of magnitude bigger than they needed to be. This was eventually solves by storing meshes as assets outside of the scene in separate files, allowing for proper monitoring of them.


Clone this wiki locally