Collision Advice/Suggestions

I am using the Panda3D collision features and I just kind have a general issue that I could use some help on. I have a setup with a model of a building and the user has the ability to go forward and turn using the arrow keys. The arrow keys directly move or rotate the camera. Initially I used a collision ray positioned directly in front of the camera with a direction pointing down to detect if a wall of the building has been hit (similar to the way its done in Roaming Ralph). However, I find that if you hit the wall on a steep enough angle you end up seeing right through that wall which is obviously a problem. So I tryed out the CollisionSphere class. This seemed to help with the problem above due to the fact that it also took into account collision testing to the side so you couldn’t hit the wall at a steep enough angle to be able to see through the walls. However, when using a sphere for collision testing, I now have an issue where I cannot go through doorways since they are not wide enough for the sphere radius.

So if anyone has some helpful advice as what a successful solution would be that would be great!

Thanks in advance.

I’d say use a smaller sphere. Don’t think of the sphere as needing to per se surround or align with your model, just as the one part of your model that is physically solid.

Short. Sweet. And Helpful.

Thanks alot Ninja.

One thing that might help is to check out GravityWalker.py under direct/controls. This class will implement a walking biped-style character that uses a downward ray to find the floor, and a sphere to detect walls.

It certainly helped me when I was in a similar situation. :slight_smile: