Skip to main content
gamedev.net
🔒 Locked

Camera Physics. Differnet Approches

Started by Muhammad Ahmed 2 replies 1k views
Original Post
Muhammad Ahmed
Muhammad Ahmed
No a days i am playing with physics. Using Ogre for graphics and PhysX for physics. http://www.ogre3d.org/phpBB2/viewtopic.php?t=42869 Also have complete code for 3rd person camera system. http://www.ogre3d.org/phpBB2/viewtopic.php?t=42900 Now i want to integrate physics and camera to collid with physical objects. I make a search on net but found nothing intresting. I want to know different approches to make camera collide with the objects. Thanks. AbsoluteCPP.
oliii
oliii
usually, a ray-cast from the anchor point to where the camera would be ideally. Or a swept volume check (put a sphere around the camera). You stop the camera at the nearest collision (with other object, or a wal, ect).
Everything is better with Metal.
Muhammad Ahmed
Muhammad Ahmed
Quote:
Original post by oliii
usually, a ray-cast from the anchor point to where the camera would be ideally. Or a swept volume check (put a sphere around the camera). You stop the camera at the nearest collision (with other object, or a wal, ect).


Can u explain in more detail,
Plz provide link regarding this technique if u have..

Thanks.
oliii
oliii
There is nothing to it really.

Usually, your camera focuses on point near the player (above the head, shoulder cam, ...), along a direction. You trace backward from that point, up to a maximum distance (say, 3 meters), and query the collision system for the first collision. Then you place the camera at that collision if there is one, else at the max distance.

I dont know physx, so I wouldn't know what calls you have to make, but it should be pretty straight forward.

Oh yeah, you probably need to use a collision callback to filter out objects that are not suppose to obstruct your camera (i.e. the player himself, the car he is driving, ect...).
Everything is better with Metal.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.