Camera Collision

Started by
1 comment, last by cmac 6 years, 3 months ago

So, im trying to make a camera collision, like any other game so the camera does not pass through walls, i have the camera attached to the player i tried a lot o different things but nothing, if anyone knows a way it would be very helpfull

Advertisement

Raycast from the player's position to the desired camera position. In the event of a hit, set the camera's position to the hit location.

 

EDIT: misread, if you're talking about a first person controller you can just use a physics library.

 

EDIT again: just saw the Unity tag. Check out its Character Controller: https://docs.unity3d.com/Manual/class-CharacterController.html

This topic is closed to new replies.

Advertisement