Hello ,
I’m developing a modular track editor. I want so create modules for the track as in slot car racing track.
My modules will be 3d-models with special properties like name, ID, description, V3 Start Point and V3 End Point. My question now is: What’s the best way to give the 3d-models these properties?
My so far solution is to create a Prefab with a Model and a Script:
(this way was inspired by an inventory-system)
[System.Serializable]
public class Modul
{
public string modulName;
public int modulID;
public string modulDesc;
public Texture2D modulIcon;
public float modulLength;
public ModulType modulType;
public List<Segment> Segments;
// custom datatype Segment (contains a V3 position and Quat rotation)
// using as [0] start point and [1] end point
public Vector3[] originCurve;
public float length;
public enum ModulType
{
Default,
TrackPart,
Decoration,
Special
}
Sadly I don’t know any better solution so far. Important for me is especially that I have the exact end points and start points of the module so that I can put the track parts together seamlessly.
Does anyone have a different solution or am I on the right track? - Thanks