AztecGameLab / LongTermGame8

2 stars 1 forks source link

Fix Camera Clipping #36

Open poetahto opened 5 months ago

poetahto commented 5 months ago

You'll probably want to create a new script attached to the root player object that references the player camera GameObject (this is a child of Player/Yaw/Pitch transforms).

Once you have a reference to the player camera, you can raycast in it's direction, and if we hit a collider we move the camera closer to the player. Of course, the camera should return to some default distance given no colliders. We also want to allow some low-priority colliders to be ignored (see: trees, small rocks, ect.), so use layers to select the colliders that are considered in the raycast.