Jump to content
  • Advertisement
Sign in to follow this  
brokenlynx

OpenGL Moveable pivot

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

Ill post this 2D demonstration of what Im trying to do first: http://www.myphysicslab.com/dbl_pendulum.html So ive managed to implement a (prototype) of a standard single swinging pendulum in openGL with some basic code (using glRotate and manipulating the first 'angle' parameter) my question is how can I implement something similar to the simulation above where the rod of the second pendulum is fixed to the 'bob' on the first pendulum with the 2nd still swinging whilst connected. Is there any particular way of being able to group objects in this manner or will I need to implement some kind of transformations to follow the first pendulum. Any help is appreciated and just ask if any more info is required: Thank you.

Share this post


Link to post
Share on other sites
Advertisement
OpenGL is just the "view" component of your system. The model component has to be entirely written by you. A simple attachment system involves a chain of parents and a simple multiplication of their transform matrices to get the child node's position:

a) mLocation
b) mLocation
c) mLocation

if c is attached to b which is attached to a then c's position is just:

c->mLocation * b->mLocation * a->mLocation

[EDIT: i think i have that ordering right... ]

where each entity's mLocation is initialized to be their offset from their parent in the parent's local space.

-me

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!