From a46f4ddb740a20a8c07e9a3f54c208eb02debf91 Mon Sep 17 00:00:00 2001 From: Programmer-DField Date: Mon, 1 Mar 2021 16:04:17 +0000 Subject: [PATCH] Have solved the problem where the camera seemed to be setting the player as dead. The script now checks to see if the collison was with player and only acts if true. --- game/Assets/Scenes/Main.unity | 27 ++++++++++++++++++----- game/Assets/Scripts/Traps/FallingRocks.cs | 11 +++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/game/Assets/Scenes/Main.unity b/game/Assets/Scenes/Main.unity index f3758db..7913970 100644 --- a/game/Assets/Scenes/Main.unity +++ b/game/Assets/Scenes/Main.unity @@ -1357,7 +1357,7 @@ SphereCollider: m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Radius: 0.5 + m_Radius: 0.52 m_Center: {x: 0, y: 0, z: 0} --- !u!23 &723599533 MeshRenderer: @@ -2835,8 +2835,8 @@ Camera: y: 0 width: 1 height: 1 - near clip plane: 0.3 - far clip plane: 1000 + near clip plane: 0.1 + far clip plane: 5000 field of view: 60 orthographic: 0 orthographic size: 5 @@ -2908,8 +2908,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 13726835868299081} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: 0.12625737, y: -0.000000037322824, z: 0.0000000047502957, w: 0.99199754} + m_LocalPosition: {x: 0, y: 2.096951, z: -3.0069473} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 13726836045578990} @@ -3115,6 +3115,7 @@ GameObject: - component: {fileID: 13726835985748589} - component: {fileID: 3320306144543951519} - component: {fileID: 959869475} + - component: {fileID: 13726836045578772} m_Layer: 0 m_Name: Player m_TagString: Player @@ -3122,6 +3123,20 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!136 &13726836045578772 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 13726836045578771} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.4 + m_Height: 1.8 + m_Direction: 1 + m_Center: {x: 0, y: 0.85, z: 0} --- !u!4 &13726836045578990 Transform: m_ObjectHideFlags: 0 @@ -3495,4 +3510,4 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: attenuationObject: {fileID: 0} - ListenerNumber: -1 + ListenerNumber: 0 diff --git a/game/Assets/Scripts/Traps/FallingRocks.cs b/game/Assets/Scripts/Traps/FallingRocks.cs index 37c87c9..7181e88 100644 --- a/game/Assets/Scripts/Traps/FallingRocks.cs +++ b/game/Assets/Scripts/Traps/FallingRocks.cs @@ -25,9 +25,12 @@ public class FallingRocks : MonoBehaviour // Use OnCollison to call respawn method from DeathZone script. private void OnCollisionEnter(Collision collision) { - // Check code is working in log. Can be deleted at a later stage. - Debug.Log("Dead"); - // Call respawn coroutine from DeathZone script. - StartCoroutine(_dz.RespawnPlayer()); + if (collision.gameObject.CompareTag("Player")) + { + // Check code is working in log. Can be deleted at a later stage. + Debug.Log("Dead"); + // Call respawn coroutine from DeathZone script. + StartCoroutine(_dz.RespawnPlayer()); + } } }