Jump to content
  • Advertisement
Sign in to follow this  
Muhammad Ahmed

Camera Physics. Differnet Approches

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

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.

Share this post


Link to post
Share on other sites
Advertisement
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!