Sign in to follow this  

fps camera collison in rooms?

This topic is 2309 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

I am abit stuck with how a first person camera ,will not be able to go through walls , basically i think there should be 4 rays to cover w's'a'd movement but there still would be gaps inbetween the , so do you have to place a ray in a 360 direction of the camera to cover any bugs, thanks if you can explain it better

Share this post


Link to post
Share on other sites
I think you're probably going down the wrong track with the idea of 'rays' moving out in four directions.

I'm guessing that you're talking about how to keep the player from walking through walls. Generally you would probably do this just like any other entity in your game, you would need a proper collision detection system. Walls would be represented rectangles or lines, and your player could be represented as a circle, you just have to reject any movement where the circle would overlap with other solid objects.

You can write your own collision detection for this or use any of a number of physics engines. I don't think casting rays is how I've ever heard of this being done.

Share this post


Link to post
Share on other sites
The best way would be to probably represent the player as an ellipsoid. The problem with the 4-ray approach is it's likely to be slower and you will also run into problems when the player tries to pan around while they're next to another collision object. Are you using a physics engine or attempting to write your own?

Share this post


Link to post
Share on other sites
Quote:
Original post by fitfool
The best way would be to probably represent the player as an ellipsoid.
Just to make sure the OP knows what options are available, it should probably be mentioned that an ellipsoid probably isn't the 'best' representation, per se. It's a viable option, but axis-aligned boxes, capsules, and cylinders are also effective and are often used successfully in practice. (Cylinders aren't a very good choice for general collision detection, but can still work effectively in certain circumstances.)

Share this post


Link to post
Share on other sites

This topic is 2309 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