Sign in to follow this  

camera issues in our game

This topic is 3153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a little background about our camera...we're using Hooke's law for spring physics to keep the camera attached to the player. It looks GREAT! BUT. . . If our camera is close to the wall and our player is close to the wall, the camera clips through part of the wall and you can see outside of our level. We've tried setting the collision volume of the camera to be a little bit bigger so that it can't get close enough to a wall, but our level is in close quarters, so this stops us from going through hallways and if the camera ends up in a corner is starts bouncing back and forth really bad. I can post code if you'd like to see it, but that's not really necessary. I just need some theory behind this. Thanks for the help.

Share this post


Link to post
Share on other sites
I'm assuming you have some kind of collision geometry for your level that prevents the player from walking through the outer walls. In this case, simply cast a ray from the player position to the camera position. If this ray intersects collision geometry, clip the camera to the intersection point instead of the original location.

That should take care of the vast majority of cases, without compromising too much of your attachment system's effect.

Share this post


Link to post
Share on other sites

This topic is 3153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this