Jump to content
  • Advertisement
Sign in to follow this  
muimui1911

collision detection after objects are moved

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

hello everyone, In my program, objects are loaded from .3ds format and the collision detection is done by checking every polygon against a sphere bounded camera. the geometry of the objects are stored in std: vector<> . All the things i have mentioned are working correctly, but it have problems are traslation. My question is if I move an object using glTranslatef() then the object is translated correctly, however, all the coordinates of the translated object is still the same, so when detecting collisions it didn't collide correctly. have anyone have such experience or anyone can help me or give me suggestion on how to solving this problem. millions of thanks

Share this post


Link to post
Share on other sites
Advertisement
if i translate the selected objects, shouldn't if be add instead of multiple the model view?

i have loop through all the faces and vertices and add it by the number that i wanna translate, unfortunately it doesn't seems to work.

please give me more advise on it if anyone have a better way of doing so.

thanks

Share this post


Link to post
Share on other sites
OpenGL is for Rendering only.
so a function call to glTranslateF Only affects where the object gets drawn on your screen.
I does not actually change their coordinates permanently.
For your collision detection, you will need to track movement separately.
You will want each object to have coordinates data separate from the graphical information. Write your own translation function to move the objects around for collision detection changes, and have the glTranslateF function separate for when it comes time to render.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!