From 26e006d7a8a8d2942a280691aa2e95b4a49e2e13 Mon Sep 17 00:00:00 2001 From: Griffin Teller Date: Sat, 11 Jul 2020 11:58:27 -0700 Subject: [PATCH 1/4] Made box colliders independent and added collider to tire --- Assets/Prefab/Part/Play/BasicTire.prefab | 19 +++++++++++++++++-- Assets/Scripts/Main/DesignLoaderPlay.cs | 24 +----------------------- Assets/Scripts/Utility/MetaUtility.cs | 5 +++++ 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Assets/Prefab/Part/Play/BasicTire.prefab b/Assets/Prefab/Part/Play/BasicTire.prefab index 084d5f4..f605ca6 100644 --- a/Assets/Prefab/Part/Play/BasicTire.prefab +++ b/Assets/Prefab/Part/Play/BasicTire.prefab @@ -201,6 +201,7 @@ GameObject: - component: {fileID: 3923196539191495623} - component: {fileID: 3226723001406992128} - component: {fileID: 4734048834668821019} + - component: {fileID: 8195048015080138190} m_Layer: 0 m_Name: BasicTire m_TagString: Untagged @@ -235,8 +236,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 782460a61c9c454b9fda77e87e8e3e01, type: 3} m_Name: m_EditorClassIdentifier: - innerMesh: {fileID: 212465993580246236} _tireComponent: {fileID: 4734048834668821019} + innerMesh: {fileID: 212465993580246236} tireMeshRoot: {fileID: 0} wheelCollider: {fileID: 0} --- !u!114 &4734048834668821019 @@ -251,5 +252,19 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1416999b371041a993ba1d4cc6fa7c56, type: 3} m_Name: m_EditorClassIdentifier: - bearing: 0 baseSteerAngle: 0 + bearing: 0 + WheelCollider: {fileID: 0} +--- !u!65 &8195048015080138190 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5299458965186968501} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.3406933, y: 0.42197776, z: 0.9126946} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/Main/DesignLoaderPlay.cs b/Assets/Scripts/Main/DesignLoaderPlay.cs index d77fd81..614506d 100644 --- a/Assets/Scripts/Main/DesignLoaderPlay.cs +++ b/Assets/Scripts/Main/DesignLoaderPlay.cs @@ -3,6 +3,7 @@ using Building; using Photon.Pun; using UnityEngine; +using Utility; namespace Main { @@ -29,28 +30,6 @@ public void BuildRobotRpc(object data) BuildRobot(structure); } - private void ReplaceColliders() - { - var newColliderRelativeBounds = new Bounds(Vector3.zero, Vector3.zero); - var buffer = new Vector3(1, 0, 1) * 2 * ColliderBuffer; - - foreach (var boxCollider in structureRoot.GetComponentsInChildren()) - { - var colliderBounds = new Bounds( - boxCollider.transform.localPosition, - boxCollider.size + buffer); - - newColliderRelativeBounds.Encapsulate(colliderBounds); - - Destroy(boxCollider); - } - - var newBoxCollider = structureRoot.gameObject.AddComponent(); - newBoxCollider.center = Vector3.zero; - newBoxCollider.size = newColliderRelativeBounds.size; - _robotRigidbody.centerOfMass = Vector3.zero; - } - public void BuildRobot(RobotStructure structure = null) { LoadPartListIntoDict(); @@ -62,7 +41,6 @@ public void BuildRobot(RobotStructure structure = null) } CreateParts(structure); - ReplaceColliders(); robotMain.OnPartsLoaded(); } diff --git a/Assets/Scripts/Utility/MetaUtility.cs b/Assets/Scripts/Utility/MetaUtility.cs index ade5c0f..c9c71be 100644 --- a/Assets/Scripts/Utility/MetaUtility.cs +++ b/Assets/Scripts/Utility/MetaUtility.cs @@ -66,5 +66,10 @@ public static void DestroyImmediateAllChildren(GameObject gameObject) foreach (Transform child in gameObject.transform) UnityEngine.Object.DestroyImmediate(child.gameObject); } + + public static Vector3 Vector3Abs(Vector3 vector) + { + return new Vector3(Mathf.Abs(vector.x), Mathf.Abs(vector.y), Mathf.Abs(vector.y)); + } } } \ No newline at end of file From e737134ce8051a4094d38c8c976719093b07f1e5 Mon Sep 17 00:00:00 2001 From: Griffin Teller Date: Sun, 12 Jul 2020 18:03:50 -0700 Subject: [PATCH 2/4] Moved build tire collider into correct position --- Assets/Prefab/Part/Building/BasicTire.prefab | 8 ++++---- ProjectSettings/EditorBuildSettings.asset | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Prefab/Part/Building/BasicTire.prefab b/Assets/Prefab/Part/Building/BasicTire.prefab index 55ad433..e70f8a2 100644 --- a/Assets/Prefab/Part/Building/BasicTire.prefab +++ b/Assets/Prefab/Part/Building/BasicTire.prefab @@ -203,8 +203,8 @@ BoxCollider: m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 0.31299046, y: 0.9060723, z: 0.9030622} - m_Center: {x: 0, y: 0, z: 0} + m_Size: {x: 0.31299046, y: 0.9229157, z: 0.9030622} + m_Center: {x: 0, y: -0.22177482, z: 0} --- !u!114 &5573408519385158023 MonoBehaviour: m_ObjectHideFlags: 0 @@ -217,8 +217,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f2211cf0b3c94b189ae6cc6794db361b, type: 3} m_Name: m_EditorClassIdentifier: - removable: 1 - partName: BasicTire mass: 20 + partName: BasicTire + removable: 1 collider: {fileID: 2160681236945319564} tireName: diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 3fd15c1..7f07d37 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -17,7 +17,7 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/BuildScene.unity guid: d950b2e5c72befc4798a2812dd7fa1fb - - enabled: 1 + - enabled: 0 path: Assets/Scenes/NewMainMenu.unity guid: dd1b1c3cdb239af45af5bc3baf78e8c5 m_configObjects: From 8aea5da02253398c5d6546a85b81a0745a7a84d3 Mon Sep 17 00:00:00 2001 From: Griffin Teller Date: Sun, 12 Jul 2020 18:04:20 -0700 Subject: [PATCH 3/4] Changed version no --- ProjectSettings/ProjectSettings.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 28cea3e..03469d6 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -121,7 +121,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 0.3.4-dev.4 + bundleVersion: 0.3.4-alpha.1 preloadedAssets: - {fileID: 0} - {fileID: 0} From c6b17537b3c79a9e38c3d55216e4d472de210dc7 Mon Sep 17 00:00:00 2001 From: Griffin Teller Date: Sun, 12 Jul 2020 18:27:22 -0700 Subject: [PATCH 4/4] final --- ProjectSettings/GraphicsSettings.asset | 1 + 1 file changed, 1 insertion(+) diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 4706883..fcda775 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -38,6 +38,7 @@ GraphicsSettings: - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0} m_PreloadedShaders: [] m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}