Fix SubModelLoading, Fix bike, Add Bike Coloring + correct offsets, remove ERL port 0

This commit is contained in:
Tim
2025-06-09 12:59:43 +02:00
parent 3d61d3b0a9
commit 32578e24a6
22 changed files with 365 additions and 441 deletions

View File

@@ -110,7 +110,7 @@ Material:
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -30,7 +30,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@@ -19138,7 +19138,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1591058970}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
m_Name:
@@ -19175,7 +19175,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
rayTransform: {fileID: 837617862}
rayTransform: {fileID: 0}
m_Cursor: {fileID: 0}
joyPadClickButton: 1
gazeClickKey: 32
@@ -19231,7 +19231,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1591058970}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2518c50cb3fc6a6458d4b743c2f69c7d, type: 3}
m_Name:

View File

@@ -11,17 +11,12 @@ public class Definitions
public const string PORT_BIKE_PEDAL_L = "bikePedalL";
public const string PORT_BIKE_PEDAL_R = "bikePedalR";
public const string PORT_BIKE_STEER = "bikeSteer";
public const string PORT_BIKE_WHEEL_F = "bikeWheelF";
public const string PORT_BIKE_WHEEL_F2 = "bikeWheelF2";
public const string PORT_BIKE_TIRE_FRONT = "bikeTireFront";
public const string PORT_BIKE_DRIVER = "bikeDriver";
public const string PORT_BIKE_WHEEL_B = "bikeWheelB";
public const string PORT_BIKE_WHEEL_B2 = "bikeWheelB2";
public const string PORT_BIKE_RIM = "bikeRim";
public const string PORT_BIKE_TIRE = "bikeTire";
// ERLCAR PORTS
// TODO: rename all important ones
// ERLCAR PORTS
public const string PORT_ERLBACH_0 = "portErlbach0";
public const string PORT_ERLBACH_1 = "portErlbach1";
public const string PORT_ERLBACH_2 = "portErlbach2";
public const string PORT_ERLBACH_3 = "portErlbach3";
@@ -95,7 +90,7 @@ public class Definitions
public const string PORT_ERLBACH_71 = "portErlbach71";
public const string PORT_ERLBACH_72 = "portErlbach72";
public const string PORT_ERLBACH_73 = "portErlbach73";
public const string PORT_ERLBACH_BasePlate= "portErlbach74";
public const string PORT_ERLBACH_BasePlate = "portErlbach74";
public const string PORT_ERLBACH_FrontAxe = "portErlbach75";
public const string PORT_ERLBACH_BatteriePack = "batteriePack";
public const string PORT_ERLBACH_77 = "portErlbach77";
@@ -104,7 +99,7 @@ public class Definitions
public const string Port_Erlbach_Wheel_LH = "wheel_LH";
public const string Port_Erlbach_Wheel_LV = "wheel_LV";
public const string PORT_ERLBACH_Wheel_RV = "wheel_RV";
public const string PORT_ERLBACH_Wheel_RH= "wheel_RH";
public const string PORT_ERLBACH_Wheel_RH = "wheel_RH";
public const string PORT_ERLBACH_Body = "body";
public const string PORT_ERLBACH_Bumper = "portErlbach85";
public const string PORT_ERLBACH_FrontBumper = "portErlbach86";
@@ -115,7 +110,4 @@ public class Definitions
public const string PORT_ERLBACH_Refelctor_H = "portErlbach91";
public const string PORT_ERLBACH_Headlight_V_Cover = "portErlbach92";
public const string PORT_ERLBACH_Headlight_V = "portErlbach93";
}

View File

@@ -60,9 +60,9 @@ public class ModelBehaviour : MonoBehaviour
transform.localRotation *= Quaternion.Inverse(Model.Rotation);
transform.localScale -= Model.Scale;
}
Debug.Log($"Model {name} update to new {newModel} Model.");
//kill old children
foreach (var compo in GetComponentsInChildren<ChildModelBehaviour>())
{
@@ -73,7 +73,7 @@ public class ModelBehaviour : MonoBehaviour
Debug.Log($"Destroying {name}'s Child {compo.gameObject.name}");
Destroy(compo.gameObject); // will be destroyed next frame
}
//spawn new childPorts
if (newModel.HasPorts())
{
@@ -134,7 +134,7 @@ public class ModelBehaviour : MonoBehaviour
continue;
}
Debug.Log($"POSS {child.transform.gameObject.name} pos {child.transform.localPosition} {child.transform.localRotation} {child.transform.localScale}");
Debug.Log($"POS {child.transform.gameObject.name} pos {child.transform.localPosition} {child.transform.rotation} {child.transform.localScale}");
cmb.ChildModel = childModel;
port.Apply(child.transform); // move to correct position
}

View File

@@ -9,7 +9,6 @@ public class ModelList
{
public static List<Color> DefaultColors = new List<Color>()
{
Color.black,
Color.gray,
Color.white,
@@ -19,9 +18,8 @@ public class ModelList
Color.yellow,
Color.magenta,
Color.cyan,
};
public static readonly List<BaseModel> BaseModels = new List<BaseModel>()
{
new BaseModel(
@@ -29,22 +27,22 @@ public class ModelList
"bike",
Resources.Load<Mesh>("Model/Bicycle/Models/Low-Poly Bicycle"),
Resources.Load<Material>($"Material/Default"),
Vector3.zero,
Quaternion.Euler(0,90,0),
Vector3.zero,
Quaternion.Euler(0, 0, 0),
Vector3.one,
new List<Port>
{
Port.Choosable("Frame", Definitions.PORT_BIKE_FRAME, "idBikeFrame", new Vector3(0,1,0)),
Port.Choosable("Frame 2", Definitions.PORT_BIKE_FRAME2, "idBikeFrame2", new Vector3(0,1,0)),
Port.Choosable("Sprocket", Definitions.PORT_BIKE_SPROCKET, "idBikeSprocket", new Vector3(0.007933f, 0.444f, -0.1614f)),
Port.Choosable("Left Pedal", Definitions.PORT_BIKE_PEDAL_L, "idBikePedalL_1", new Vector3(-0.1252177f, 0.5490288f, -0.312027f)),
Port.Choosable("Right Pedal", Definitions.PORT_BIKE_PEDAL_R, "idBikePedalR_1", new Vector3(0.1410843f, 0.3393247f, -0.01154391f)),
Port.Choosable("Handlebars", Definitions.PORT_BIKE_STEER, "idBikeHandlebars",new Vector3(0.002989591f, 1.214713f, 0.4860705f), Quaternion.Euler(-30f, 0f, 0f)),
Port.Choosable("Back Wheel", Definitions.PORT_BIKE_WHEEL_B,"idBikeWheel_Back1", new Vector3(-0.01431298f, 0.4673222f, -0.7874681f)),
Port.Choosable("Back Wheel 2", Definitions.PORT_BIKE_WHEEL_B2, "idBikeWheel_Back2", new Vector3(-0.01431298f, 0.4673222f, -0.7874681f)),
Port.Choosable("Front Wheel", Definitions.PORT_BIKE_WHEEL_F, "idBikeWheel_Front1", new Vector3(0.01984263f, 0.4673225f, 0.9462124f)),
Port.Choosable("Front Wheel2 ", Definitions.PORT_BIKE_WHEEL_F2,"idBikeWheel_Front2", new Vector3(0.01984263f, 0.4673225f, 0.9462124f)),
Port.Choosable("Driver", Definitions.PORT_BIKE_DRIVER, "nuke", new Vector3(0f, 1.25f, -0.65f), Quaternion.Euler(70f, 0f, 0f)),
Port.Choosable("Attachments", Definitions.PORT_BIKE_FRAME, "idBikeAttachments", new Vector3(0, 0, 0)),
Port.Choosable("Frame", Definitions.PORT_BIKE_FRAME2, "idBikeFrame", new Vector3(0, 0, 0)),
Port.Hidden(Definitions.PORT_BIKE_SPROCKET, "idBikeSprocket", new Vector3(0.007933f, 0.444f, -0.1614f)),
Port.Hidden(Definitions.PORT_BIKE_PEDAL_L, "idBikePedalL", new Vector3(-0.1252177f, 0.5490288f, -0.312027f)),
Port.Hidden(Definitions.PORT_BIKE_PEDAL_R, "idBikePedalR", new Vector3(0.1410843f, 0.3393247f, -0.01154391f)),
Port.Choosable("Handlebars", Definitions.PORT_BIKE_STEER, "idBikeHandlebars", new Vector3(0.002989591f, 1.214713f, 0.4860705f), Quaternion.Euler(-30f, 90f, 0f)),
Port.Choosable("Back Rim", Definitions.PORT_BIKE_RIM, "idBikeRim_Back", new Vector3(-0.01431298f, 0.4673222f, -0.7874681f)),
Port.Hidden(Definitions.PORT_BIKE_TIRE, "idBikeTire_Back", new Vector3(-0.01431298f, 0.4673222f, -0.7874681f)),
Port.Choosable("Front Rim", Definitions.PORT_BIKE_RIM, "idBikeRim_Front", new Vector3(0.01984263f, 0.4673225f, 0.9462124f)),
Port.Hidden( Definitions.PORT_BIKE_TIRE_FRONT, "idBikeTire_Front", new Vector3(0.01984263f, 0.4673225f, 0.9462124f)),
Port.Choosable("Driver", Definitions.PORT_BIKE_DRIVER, "nuke", new Vector3(0f, 1.25f, -0.65f), Quaternion.Euler(70f, 90f, 0f)),
}
),
new BaseModel(
@@ -52,12 +50,11 @@ public class ModelList
"erlbach",
Resources.Load<Mesh>("Model/ERLbach/02.01.98.0000-ERLbach_vereinfacht_ohneFenster"),
Resources.Load<Material>($"Material/Default"),
new Vector3(0,0,4f), //big car needs big space
Quaternion.Euler(-90f,0f,0f), //rotate correctly
new Vector3(0.03f,0.03f,0.03f), //because model is too big in space
new Vector3(0, 0, 4f), //big car needs big space
Quaternion.Euler(0, 0, -90f), //rotate correctly
new Vector3(0.03f, 0.03f, 0.03f), //because model is too big in space
new List<Port>
{
Port.Hidden(Definitions.PORT_ERLBACH_0, "idErlbachPart0", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_1, "idErlbachPart1", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_2, "idErlbachPart2", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_3, "idErlbachPart3", new Vector3(0f, 0f, 0f)),
@@ -131,26 +128,26 @@ public class ModelList
Port.Hidden(Definitions.PORT_ERLBACH_71, "idErlbachPart71", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_72, "idErlbachPart72", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_73, "idErlbachPart73", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_BasePlate, "idErlbachPart74", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,0f,0f)),
Port.Hidden(Definitions.PORT_ERLBACH_FrontAxe, "idErlbachPart75", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f,0f,0f)),
Port.Hidden(Definitions.PORT_ERLBACH_BatteriePack, "idErlbachPart76", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,0f,1f)),
Port.Hidden(Definitions.PORT_ERLBACH_BasePlate, "idErlbachPart74", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_FrontAxe, "idErlbachPart75", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_BatteriePack, "idErlbachPart76", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, 0f, 1f)),
Port.Hidden(Definitions.PORT_ERLBACH_77, "idErlbachPart77", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_78, "idErlbachPart78", new Vector3(0f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_79, "idErlbachPart79", new Vector3(0f, 0f, 0f)),
Port.Choosable("Wheel Back Left", Definitions.Port_Erlbach_Wheel_LH, "idErlbachWheel_LH", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,-1f,0f)),
Port.Choosable("Wheel Front Left", Definitions.Port_Erlbach_Wheel_LV, "idErlbachWheel_LV", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,-1f,0f)),
Port.Choosable("Wheel Back Right", Definitions.PORT_ERLBACH_Wheel_RH, "idErlbachWheel_RH", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,1f,0f)),
Port.Choosable("Wheel Front Right", Definitions.PORT_ERLBACH_Wheel_RV, "idErlbachWheel_RV", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,1f,0f)),
Port.Choosable("Body", Definitions.PORT_ERLBACH_Body, "idErlbachPart84", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f,0f,1f)),
Port.Choosable("Bumper", Definitions.PORT_ERLBACH_Bumper, "idErlbachPart85", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f,0f,0f)),
Port.Choosable("Front Bumper", Definitions.PORT_ERLBACH_FrontBumper, "idErlbachPart86", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f,0f,0f)),
Port.Choosable("Number", Definitions.PORT_ERLBACH_Number, "idErlbachPart87", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f,0f,0f)),
Port.Choosable("License Plate", Definitions.PORT_ERLBACH_LicensePlate, "idErlbachPart88", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f,0f,0f)),
Port.Hidden(Definitions.PORT_ERLBACH_LicensePlateContent, "idErlbachPart89", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f,0f,0f)),
Port.Choosable("Grill", Definitions.PORT_ERLBACH_Grill, "idErlbachPart90", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f,0f,0f)),
Port.Hidden(Definitions.PORT_ERLBACH_Refelctor_H, "idErlbachPart91", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f,0f,0f)),
Port.Hidden(Definitions.PORT_ERLBACH_Headlight_V_Cover, "idErlbachPart92", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f,0f,0f)),
Port.Hidden(Definitions.PORT_ERLBACH_Headlight_V, "idErlbachPart93", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f,0f,0f)),
Port.Choosable("Wheel Back Left", Definitions.Port_Erlbach_Wheel_LH, "idErlbachWheel_LH", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, -1f, 0f)),
Port.Choosable("Wheel Front Left", Definitions.Port_Erlbach_Wheel_LV, "idErlbachWheel_LV", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, -1f, 0f)),
Port.Choosable("Wheel Back Right", Definitions.PORT_ERLBACH_Wheel_RH, "idErlbachWheel_RH", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, 1f, 0f)),
Port.Choosable("Wheel Front Right", Definitions.PORT_ERLBACH_Wheel_RV, "idErlbachWheel_RV", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, 1f, 0f)),
Port.Choosable("Body", Definitions.PORT_ERLBACH_Body, "idErlbachPart84", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(0f, 0f, 1f)),
Port.Choosable("Bumper", Definitions.PORT_ERLBACH_Bumper, "idErlbachPart85", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f, 0f, 0f)),
Port.Choosable("Front Bumper", Definitions.PORT_ERLBACH_FrontBumper, "idErlbachPart86", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f, 0f, 0f)),
Port.Choosable("Number", Definitions.PORT_ERLBACH_Number, "idErlbachPart87", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f, 0f, 0f)),
Port.Choosable("License Plate", Definitions.PORT_ERLBACH_LicensePlate, "idErlbachPart88", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_LicensePlateContent, "idErlbachPart89", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f, 0f, 0f)),
Port.Choosable("Grill", Definitions.PORT_ERLBACH_Grill, "idErlbachPart90", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_Refelctor_H, "idErlbachPart91", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(1f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_Headlight_V_Cover, "idErlbachPart92", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f, 0f, 0f)),
Port.Hidden(Definitions.PORT_ERLBACH_Headlight_V, "idErlbachPart93", new Vector3(0f, 0f, 0f), Quaternion.identity, 1f, new Vector3(-1f, 0f, 0f)),
}
)
};
@@ -161,64 +158,33 @@ public class ModelList
"Bacteria",
"bacteria",
Resources.Load<Mesh>("Plagues/Mesh/bacteria"),
Resources.Load<Material>($"Material/Default"),
null
Resources.Load<Material>($"Material/Universal"),
new Vector3(0f, 0.2f, 0.3f),
Quaternion.identity,
Vector3.one,
null,
DefaultColors
),
new ChildModel(
Definitions.PORT_BIKE_DRIVER,
"ICBM",
"nuke",
Resources.Load<Mesh>("Plagues/Mesh/Nuke"),
Resources.Load<Material>($"Material/Default"),
null
Resources.Load<Material>($"Material/AluminiumScratched"),
null,
DefaultColors
),
new ChildModel(
Definitions.PORT_BIKE_WHEEL_B,
"30\" Rim",
"idBikeWheel_Back1",
Resources.Load<Mesh>("Plagues/Mesh/Hex"),
Resources.Load<Material>($"Material/Default"),
null
),
new ChildModel(
Definitions.PORT_BIKE_WHEEL_B2,
"30\" Rim",
"idBikeWheel_Back2",
Resources.Load<Mesh>("Plagues/Mesh/Hex"),
Resources.Load<Material>($"Material/Default"),
null
),
new ChildModel(
Definitions.PORT_BIKE_WHEEL_F,
"30\" Rim",
"idBikeWheel_Front1",
Resources.Load<Mesh>("Plagues/Mesh/Hex"),
Resources.Load<Material>($"Material/Default"),
null
),
new ChildModel(
Definitions.PORT_BIKE_WHEEL_F2,
"30\" Rim",
"idBikeWheel_Front2",
Resources.Load<Mesh>("Plagues/Mesh/Hex"),
Resources.Load<Material>($"Material/Default"),
null
),
new ChildModel(
"bikePedalR",
"Pedal (right)",
"bikePedalR",
Definitions.PORT_BIKE_RIM,
"30\" Rim",
"idBikeRim_HEX",
Resources.Load<Mesh>("Plagues/Mesh/Hex"),
Resources.Load<Material>($"Material/Default"),
null
),
new ChildModel(
"bikePedalL",
"Pedal (left)",
"bikePedalL",
Resources.Load<Mesh>("Plagues/Mesh/Hex"),
Resources.Load<Material>($"Material/Default"),
null
Resources.Load<Material>($"Material/Universal"),
Vector3.zero,
Quaternion.Euler(0,90f,0),
new Vector3(2,2,1),
null,
DefaultColors
),
//Felge 1
new ChildModel(
@@ -234,161 +200,161 @@ public class ModelList
DefaultColors
),
new ChildModel(
Definitions.PORT_ERLBACH_Wheel_RV,
"Felge 1",
"radRV",
Resources.Load<Mesh>($"Model/ERLbach/Felge1"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.PORT_ERLBACH_Wheel_RV,
"Felge 1",
"radRV",
Resources.Load<Mesh>($"Model/ERLbach/Felge1"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.Port_Erlbach_Wheel_LV,
"Felge 1",
"radLV",
Resources.Load<Mesh>($"Model/ERLbach/Felge1"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, -30f, -15f), // offset to the port
Quaternion.Euler(0, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.Port_Erlbach_Wheel_LV,
"Felge 1",
"radLV",
Resources.Load<Mesh>($"Model/ERLbach/Felge1"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, -30f, -15f), // offset to the port
Quaternion.Euler(0, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.Port_Erlbach_Wheel_LH,
"Felge 1",
"radLH",
Resources.Load<Mesh>($"Model/ERLbach/Felge1"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-60f, -30f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.Port_Erlbach_Wheel_LH,
"Felge 1",
"radLH",
Resources.Load<Mesh>($"Model/ERLbach/Felge1"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-60f, -30f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
//Felge 2
new ChildModel(
Definitions.PORT_ERLBACH_Wheel_RH,
"Felge 2",
"radRH2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(60f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.PORT_ERLBACH_Wheel_RH,
"Felge 2",
"radRH2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(60f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.PORT_ERLBACH_Wheel_RV,
"Felge 2",
"radRV2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.PORT_ERLBACH_Wheel_RV,
"Felge 2",
"radRV2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.Port_Erlbach_Wheel_LV,
"Felge 2",
"radLV2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, -30f, -15f), // offset to the port
Quaternion.Euler(0, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.Port_Erlbach_Wheel_LV,
"Felge 2",
"radLV2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, -30f, -15f), // offset to the port
Quaternion.Euler(0, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.Port_Erlbach_Wheel_LH,
"Felge 2",
"radLH2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-60f, -30f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.Port_Erlbach_Wheel_LH,
"Felge 2",
"radLH2",
Resources.Load<Mesh>($"Model/ERLbach/Felge2"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-60f, -30f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
//Felge 3
new ChildModel(
Definitions.PORT_ERLBACH_Wheel_RH,
"Felge 3",
"radRH3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(60f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.PORT_ERLBACH_Wheel_RH,
"Felge 3",
"radRH3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(60f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.PORT_ERLBACH_Wheel_RV,
"Felge 3",
"radRV3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.PORT_ERLBACH_Wheel_RV,
"Felge 3",
"radRV3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, 65f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.Port_Erlbach_Wheel_LV,
"Felge 3",
"radLV3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, -30f, -15f), // offset to the port
Quaternion.Euler(0, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.Port_Erlbach_Wheel_LV,
"Felge 3",
"radLV3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-105f, -30f, -15f), // offset to the port
Quaternion.Euler(0, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.Port_Erlbach_Wheel_LH,
"Felge 3",
"radLH3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-60f, -30f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
Definitions.Port_Erlbach_Wheel_LH,
"Felge 3",
"radLH3",
Resources.Load<Mesh>($"Model/ERLbach/Felge3"),
Resources.Load<Material>($"Material/CarTire"),
new Vector3(-60f, -30f, -15f), // offset to the port
Quaternion.Euler(-180, 0, 0),
new Vector3(1f, 1f, 1f),
null,
DefaultColors
),
new ChildModel(
Definitions.PORT_ERLBACH_Grill,
"Grill",
"idErlbachGrill",
Resources.Load<Mesh>("Model/ERLbach/Grill1"),
Resources.Load<Material>("Material/Universal"),
new Vector3(-145f, -35f, 25f), // offset to the port
Quaternion.Euler(0f, 180f, -90f), // no rotation
new Vector3(1f, 1f, 1f), // scale
null, // no children
DefaultColors // default colors
)
Definitions.PORT_ERLBACH_Grill,
"Grill",
"idErlbachGrill",
Resources.Load<Mesh>("Model/ERLbach/Grill1"),
Resources.Load<Material>("Material/Universal"),
new Vector3(-145f, -35f, 25f), // offset to the port
Quaternion.Euler(0f, 180f, -90f), // no rotation
new Vector3(1f, 1f, 1f), // scale
null, // no children
DefaultColors // default colors
)
};
static ModelList()
{
if (!ColorUtility.TryParseHtmlString("#4c00b0", out Color purple))
{
Debug.LogError("Who messed the Hex code up?");
Debug.LogError("Who messed the purple Hex code up?");
return;
}
DefaultColors.Add(purple);
/*
* ██████ ██ ██ ██ ███████
@@ -397,20 +363,22 @@ public class ModelList
* ██ ██ ██ ██ ██ ██
* ██████ ██ ██ ██ ███████
*/
List<ModelElement> modelElements = new List<ModelElement>();
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_FRAME, "Frame", "idBikeFrame", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_FRAME2, "Frame2", "idBikeFrame2", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_PEDAL_L, "Left Pedal", "idBikePedalL_1", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_PEDAL_R, "Right Pedal", "idBikePedalR_1", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_STEER, "Handlebars", "idBikeHandlebars", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_SPROCKET, "Sprocket", "idBikeSprocket", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_WHEEL_B, "Back Wheel", "idBikeWheel_Back1", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_WHEEL_B2, "Back Wheel2", "idBikeWheel_Back2", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_WHEEL_F, "Front Wheel", "idBikeWheel_Front1", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
modelElements.Add(new ModelElement(Definitions.PORT_BIKE_WHEEL_F2, "Front Wheel2", "idBikeWheel_Front2", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors));
ModelLoader.LoadChildFromPackedModel(ChildModels, modelElements,
Resources.LoadAll<Mesh>($"Model/Bicycle/Models/Low-Poly Bicycle"),0);
ModelLoader.LoadChildFromPackedModel(ChildModels,
new List<ModelElement>
{
new ModelElement(Definitions.PORT_BIKE_FRAME, "Attachments", "idBikeAttachments", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_FRAME2, "Frame", "idBikeFrame", Resources.Load<Material>($"Material/Universal"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_SPROCKET, "Sprocket", "idBikeSprocket", Resources.Load<Material>($"Material/AluminiumBrushed"), Vector3.zero, Quaternion.identity, Vector3.one, null, null),
new ModelElement(Definitions.PORT_BIKE_PEDAL_L, "Left Pedal", "idBikePedalL", Resources.Load<Material>($"Material/PVC"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_PEDAL_R, "Right Pedal", "idBikePedalR", Resources.Load<Material>($"Material/PVC"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_STEER, "Handlebars", "idBikeHandlebars", Resources.Load<Material>($"Material/AluminiumScratched"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_RIM, "Back Wheel", "idBikeRim_Back", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_TIRE, "Back Wheel2", "idBikeTire_Back", Resources.Load<Material>($"Material/PlasticCable"), Vector3.zero, Quaternion.identity, Vector3.one, null, null),
new ModelElement(Definitions.PORT_BIKE_RIM, "Front Wheel", "idBikeRim_Front", Resources.Load<Material>($"Material/AluminiumPolished"), Vector3.zero, Quaternion.identity, Vector3.one, null, DefaultColors),
new ModelElement(Definitions.PORT_BIKE_TIRE_FRONT, "Front Wheel2", "idBikeTire_Front", Resources.Load<Material>($"Material/PlasticCable"), Vector3.zero, Quaternion.identity, Vector3.one, null, null)
},
Resources.LoadAll<Mesh>($"Model/Bicycle/Models/Low-Poly Bicycle"),
0);
/*
* ███████ ██████ ██ ██████ █████ ██████ ██ ██
@@ -422,9 +390,8 @@ public class ModelList
ModelLoader.LoadChildModelsFromPackedModel(
ChildModels,
new string[94] // port
new string[93] // port
{
Definitions.PORT_ERLBACH_0,
Definitions.PORT_ERLBACH_1,
Definitions.PORT_ERLBACH_2,
Definitions.PORT_ERLBACH_3,
@@ -519,9 +486,8 @@ public class ModelList
Definitions.PORT_ERLBACH_Headlight_V_Cover,
Definitions.PORT_ERLBACH_Headlight_V,
},
new string[94] //human name
new string[93] //human name
{
"Erlbach Part 0",
"Erlbach Part 1",
"Erlbach Part 2",
"Erlbach Part 3",
@@ -617,9 +583,8 @@ public class ModelList
"Erlbach Part Headlight_V",
},
new string[94] //id
new string[93] //id
{
"idErlbachPart0",
"idErlbachPart1",
"idErlbachPart2",
"idErlbachPart3",
@@ -716,7 +681,7 @@ public class ModelList
},
Resources.LoadAll<Mesh>($"Model/ERLbach/02.01.98.0000-ERLbach_vereinfacht_ohneFenster"),
new Material[94] //mat
new Material[93] //mat
{
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Default"),
@@ -792,7 +757,6 @@ public class ModelList
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Default"), // front wheel arches
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Default"),
@@ -810,10 +774,11 @@ public class ModelList
Resources.Load<Material>($"Material/Default"),
Resources.Load<Material>($"Material/Universal"), // Grill Gatter
Resources.Load<Material>($"Material/Default"), //KZ land
Resources.Load<Material>($"Material/Universal"), // grill outline
Resources.Load<Material>($"Material/Universal"), // grill outline
Resources.Load<Material>($"Material/MetalMesh"), // grill mesh
}, new Vector3[94] // positions
},
new Vector3[93] // positions
{
Vector3.zero,
Vector3.zero,
@@ -897,8 +862,7 @@ public class ModelList
Vector3.zero,
Vector3.zero,
Vector3.zero,
Vector3.zero,
Vector3.zero, // wheel RH
Vector3.zero, // wheel RH
Vector3.zero,
Vector3.zero,
Vector3.zero,
@@ -910,104 +874,103 @@ public class ModelList
Vector3.zero,
Vector3.zero,
},
new Quaternion[94] // rotations
new Quaternion[93] // rotations
{
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
Quaternion.identity,
},
new Vector3[94] // scales
new Vector3[93] // scales
{
Vector3.one,
Vector3.one,
@@ -1102,9 +1065,8 @@ public class ModelList
Vector3.one,
Vector3.one,
Vector3.one,
Vector3.one,
},
new List<Port>[94] // ports
new List<Port>[93] // ports
{
null,
null,
@@ -1199,10 +1161,9 @@ public class ModelList
null,
null,
null,
null,
},
new List<Color>[94] // colors
new List<Color>[93] // colors
{
null,
null,
@@ -1283,7 +1244,6 @@ public class ModelList
null,
null,
null,
null,
DefaultColors, // wheel
DefaultColors, // wheel
DefaultColors, // wheel
@@ -1299,7 +1259,7 @@ public class ModelList
null,
null,
},
0 //don't skip the first mesh, which is the baseModel
1 //skip the first mesh, which is the baseModel
);
}
}

View File

@@ -47,14 +47,9 @@ public class ModelManager : MonoBehaviour
}
}
// Update is called once per frame
void Update()
{
}
void RegisterChildModel(ChildModel model)
{
Debug.Log($"Registering {model.NameId} for Port {model.Port} ({model})");
//childModelDict
if (_childModelDict.ContainsKey(model.NameId))
{
@@ -63,12 +58,12 @@ public class ModelManager : MonoBehaviour
}
_childModelDict[model.NameId] = model;
//portDict
if (string.IsNullOrEmpty(model.Port))
{
_portDict.Add("null", new HashSet<ChildModel>());
Debug.LogWarning("Model " + model.NameId + " has no Port! [portDict] Skipping...");
return;
}
//portDict
if (!_portDict.ContainsKey(model.Port))
{
_portDict.Add(model.Port, new HashSet<ChildModel>());
@@ -124,7 +119,7 @@ public class ModelManager : MonoBehaviour
this.baseModelGO.AddComponent<BaseModelBehaviour>();
// Positioning
this.baseModelGO.transform.position = new Vector3(0, 0, 1);
this.baseModelGO.transform.rotation = Quaternion.Euler(0, 90, 0);
this.baseModelGO.transform.localRotation = Quaternion.Euler(0, 90, 0);
this.baseModelGO.SetActive(true);
}
this.baseModelGO.GetComponent<BaseModelBehaviour>().BaseModel = baseModel;

View File

@@ -23,11 +23,11 @@ public class Port
public void Apply(Transform target)
{
Debug.Log($"Applying port {target.gameObject.name} pos {target.localPosition} {target.localRotation} {target.localScale}");
//Debug.Log($"Applying port {target.gameObject.name} pos {target.localPosition} {target.localRotation} {target.localScale}");
target.localPosition += _position;
target.localRotation *= _rotation;
target.localScale *= _scale;
Debug.Log($"applied port {target.gameObject.name} pos {target.localPosition} {target.localRotation} {target.localScale}");
//Debug.Log($"applied port {target.gameObject.name} pos {target.localPosition} {target.localRotation} {target.localScale}");
}
public void Unapply(Transform target)
@@ -52,6 +52,10 @@ public class Port
public static Port Hidden(string portID, string defaultId, Vector3 position, Quaternion rotation = default, float scale = 1f, Vector3 explodeDirection = default)
{
if (rotation == default)
{
rotation = Quaternion.identity;
}
return new Port(
null,
portID,

View File

@@ -29,7 +29,7 @@ public class PortSelector : MonoBehaviour
continue;
}
Vector3 off = i * offset;
Debug.Log($"Adding Port {port.PortID} to Selection with {off.x}, {off.y}, {off.z}");
Debug.Log($"Adding Port {port.PortName} : {port.PortID} to Selection with {off.x}, {off.y}, {off.z}");
var go = Spawn.GO(prefab, transform, off, port.PortID + i);
ports.Add(go);
go.SetActive(true);
@@ -39,7 +39,6 @@ public class PortSelector : MonoBehaviour
{
Debug.LogWarning($"No TextMeshProUGUI found in {go.name}, cannot set text.");
}
Debug.LogError($"{port.PortName}");
text.text = port.PortName;
var psb = go.GetComponent<PortSelectorButton>();
psb.PortID = port.PortID;

View File

@@ -25,71 +25,45 @@ public class ModelLoader
)
{
Debug.Log("LoadChildModels " + fromMesh + " to " + toMesh + " from " + mats.Length + " meshes");
int sum = 0;
foreach (Mesh mesh in meshes)
{
sum += mesh.subMeshCount;
Debug.Log($"Model has {mesh.subMeshCount} subMeshes");
}
Debug.Log($"LoadChildModels needs at least {sum} Array size and has {port.Length}");
Debug.Log($"port.Length: {port.Length}, nameHuman.Length: {nameHuman.Length}, nameId.Length: {nameId.Length}, meshes.Length: {meshes.Length}, mats.Length: {mats.Length}");
int maxLength = Mathf.Min(port.Length, nameHuman.Length, nameId.Length, meshes.Length, mats.Length);
int maxI = Mathf.Min(port.Length, nameHuman.Length, nameId.Length, mats.Length);
if (toMesh == -1)
{
toMesh = meshes.Length;
}
int iOffset = 0;
for (int i = 0; i < Mathf.Min(toMesh - fromMesh + iOffset, maxLength); i++)
int i = 0;
for (int meshIndex = 0; meshIndex < toMesh - fromMesh; meshIndex++)
{
if (i >= port.Length || i >= nameHuman.Length || i >= nameId.Length || i >= meshes.Length || i >= mats.Length)
Debug.Log($"Mesh {fromMesh} to {toMesh} :: {toMesh-fromMesh} with index {meshIndex}");
Mesh mesh = meshes[fromMesh + meshIndex];
bool getSubMesh = useSubmeshes && mesh.subMeshCount > 1;
List<Mesh> subMeshes = getSubMesh ? GetSubmeshes(mesh) : new List<Mesh>{mesh};
if (getSubMesh)
{
Debug.LogError($"Index {i} liegt außerhalb der Array-Grenzen!");
break;
Debug.Log($"{i}. {subMeshes.Count} SubMeshes Found {nameId[i]}:{nameHuman[i]}");
}
Debug.Log($"{i}. {nameId[i]}:{nameHuman[i]} with {port.Length} ports");
appendList.Add(new ChildModel(
port[i],
nameHuman[i],
nameId[i],
meshes[fromMesh + i],
mats[i],
offset[i],
rotation[i],
scale[i],
ports[i],
colors?[i]
));
if (useSubmeshes && meshes[fromMesh + i].subMeshCount > 1)
for (int subMeshIndex = 0; subMeshIndex < subMeshes.Count; subMeshIndex++)
{
Debug.LogWarning($"{i}. SUBMODEL {nameId[i]}:{nameHuman[i]}");
List<Mesh> subMeshes = GetSubmeshes(meshes[fromMesh + i]);
for (int smi = 1; smi < subMeshes.Count; smi++) // the 0th model is already loaded
if (i >= maxI)
{
if (i >= maxLength)
{
Debug.LogError($"Index {i} nach Submesh-Verarbeitung außerhalb der Grenzen!");
break;
}
i++;
iOffset++; // black magic
appendList.Add(new ChildModel(
port[i],
nameHuman[i],
nameId[i],
subMeshes[smi],
mats[i],
offset[i],
rotation[i],
scale[i],
ports[i],
colors?[i]
));
Debug.LogError($"Index {i} out of bounds! Maximum: {maxI}");
Debug.LogError($"port.Length: {port.Length}, nameHuman.Length: {nameHuman.Length}, nameId.Length: {nameId.Length}, meshes.Length: {meshes.Length}, mats.Length: {mats.Length}, subMeshCount: ");
break;
}
Debug.Log($"SubMesh {subMeshIndex}");
Debug.Log($"{i}. {nameId[i]}:{nameHuman[i]} with {(ports[i] == null ? "null" : ports[i].Count)} ports");
appendList.Add(new ChildModel(
port[i],
nameHuman[i],
nameId[i],
subMeshes[subMeshIndex],
mats[i],
offset[i],
rotation[i],
scale[i],
ports[i],
colors?[i]
));
i++;
}
}
}
@@ -129,7 +103,7 @@ public class ModelLoader
scale.ToArray(), ports.ToArray(), colors.ToArray(), fromMesh, toMesh, useSubmeshes);
}
public static List<Mesh> GetSubmeshes(Mesh mesh)
static List<Mesh> GetSubmeshes(Mesh mesh)
{
List<Mesh> subMeshes = new List<Mesh>();