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.

This commit is contained in:
Programmer-DField 2021-03-01 16:04:17 +00:00
parent 4bead84e56
commit a46f4ddb74
2 changed files with 28 additions and 10 deletions

View File

@ -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

View File

@ -24,6 +24,8 @@ public class FallingRocks : MonoBehaviour
// Use OnCollison to call respawn method from DeathZone script.
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Player"))
{
// Check code is working in log. Can be deleted at a later stage.
Debug.Log("Dead");
@ -31,3 +33,4 @@ public class FallingRocks : MonoBehaviour
StartCoroutine(_dz.RespawnPlayer());
}
}
}