Jump to content
  • Advertisement
Sign in to follow this  
ehsan2004

Camera vs walls

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

Hi I'm working on a simple 3D game. I move the camera through the world. So the camera should not pass the walls.As my game has no physics, i need a simple collision detection library that support sliding the camera along the walls.I have taked a look at OPCODE, However it does not support sliding the camera( In my game, i insert the camera inside a sphere ). Any suggestion? -Ehsan-

Share this post


Link to post
Share on other sites
Advertisement
with opcode u can figure out what triangle u hit. take it's normal and move ur camera/sphere along this normal until it does not hit that triangle anymore. this is all u need to get a basic sliding.

Share this post


Link to post
Share on other sites
One method is to raycast from the position you want to look at to the position you'd like to be, and place the camera at either the first contact position or at the desired position, if no contact.

This is the easiest way to achieve decent sliding in my opinion.

Cheers

Eric

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!