Skip to content

Commit

Permalink
wip more
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Jul 12, 2024
1 parent c630a17 commit a759d3d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Assets/Scripts/Control&Input/OrbitCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ public class OrbitCamera : MonoBehaviour
private Transform cameraTransform;
private new Camera camera;

private LayerMask previousCullingMask;

public Camera Camera
{
set
{
camera = value;
previousCullingMask = camera.cullingMask;
camera.cullingMask = cullingMask | (1 << (12 + player.LayerIndex));
cameraTransform = value.transform;
}
Expand Down Expand Up @@ -71,6 +74,7 @@ public void Deactivate()
{
StopTracking();
StopCoroutine(trackingRoutine);
camera.cullingMask = previousCullingMask;
}

private IEnumerator WaitAndStopTrackingRagdoll()
Expand Down
23 changes: 23 additions & 0 deletions Assets/Scripts/Gamestate/PlayerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,29 @@ public virtual void Respawn(Transform spawnpoint)

transform.position = spawnpoint.position;
transform.rotation = spawnpoint.rotation;

playerIK.transform.localPosition = Vector3.zero;
inputManager.transform.parent.position = Vector3.zero;
inputManager.transform.parent.localPosition = Vector3.zero;
inputManager.transform.parent.rotation = Quaternion.identity;
inputManager.transform.rotation = Quaternion.identity;
GetComponent<Rigidbody>().position = spawnpoint.position;
GetComponent<PlayerMovement>().SetInitialRotation(spawnpoint.rotation.eulerAngles.y);

SetPlayerInput(inputManager);

StartCoroutine(SetTransformAfterRespawn(spawnpoint));
}

private IEnumerator SetTransformAfterRespawn(Transform spawnpoint)
{
yield return null;

playerIK.transform.localPosition = Vector3.zero;
inputManager.transform.parent.position = Vector3.zero;
inputManager.transform.parent.localPosition = Vector3.zero;
inputManager.transform.parent.rotation = Quaternion.identity;
inputManager.transform.rotation = Quaternion.identity;
GetComponent<Rigidbody>().position = spawnpoint.position;
GetComponent<PlayerMovement>().SetInitialRotation(spawnpoint.rotation.eulerAngles.y);
}
Expand Down

0 comments on commit a759d3d

Please sign in to comment.