Jump to content
  • Advertisement

Recommended Posts

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

Share this post

Link to post
Share on other sites

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

Edited by cmac

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!