Jump to content
  • Advertisement
Sign in to follow this  
jamesl22

Best solution for camera to world collisions

This topic is 2572 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 making a very simple jumping game in C++ and OpenGL. It is in first person view and my whole world is made only of cubes of uniform size. I have all the graphics sorted but I now need to work on physics between you and the rest of the environment. My question is: what is the best solution for detecting and acting upon collisions between you and the world. I don't need a full blown physics engine as im not going to be using joints and such. Plus the only thing that will be moving is the camera. I really only need to handle gravity.

Thanks,

James

Share this post


Link to post
Share on other sites
Advertisement
give the player force on 3 dimensions.

his velocity is force/mass.

Then to do collision you would propably get the grid point the camera is in using simple math, and also get the grid point below him, and get all the objects that touch either of those grid points.

If the player is in (or would be moved in) an object, make his force to that direction 0, or add something to not let him move in that direction (like changing the velocity instead of force) so you wont lose all momentum from touching a block.

Not the best way to do it and i propably explained it bad but it should work for a platformer :P

Share this post


Link to post
Share on other sites
Thanks for the reply. I was thinking of using a premade physics engine in my game. I was thinking of using tokamak (http://www.tokamakphysics.com/). I was going to make the camera a rigidbody and all of the cubes in my world animatedbodies. Would this work? How would I handle input from the user and give it to the physics engine?

Share this post


Link to post
Share on other sites
Is there a collision detection library that i can give a list of vertices, give it your position and have it return the plane normal? It needs to be in c or c++ and cross-platform.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!