Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Beads on a strring ?

This topic is 5817 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 trying to implement a string of beads, each bead can have a different mass, and always has to stay less than or equal to a set distance between the parent and child nodes on the string. I am trying to implement it, so that forces can be added to any bead on the string, and all the beads respond correctly. The code for the update method, is below (DX8), which works if forces are applied to the first bead ( with no mass or current velocity taken into account ). void CBead::update(void) { float dist; D3DXVECTOR3 out; pos += velocity; if(child != NULL) { dist = distance3D( &pos, &child->pos ); if( dist > childlinklen ) { D3DXVec3Lerp( &out, &pos, &child->pos, childlinklen / dist ); child->pos = out; } } if( parent != NULL ) { dist = distance3D( &pos, &parent->pos ); if( dist > parentlinklen ) { D3DXVec3Lerp( &out, &parent->pos, &pos, parentlinklen / dist ); pos = out; } } } Each node has a position (pos), velocity, and mass, as well as a pointers to the child and parent nodes (or null), and the respective link lengths, i''m only using the mass at the moment in the function to add a force (f) to a node ( velocity = velocity + f / mass; ), but i''m sure i''ve got to use it somehwere in the update method. I can see what is going wrong and why, I just can''t figure out the solution. If the velocity on one bead forces it further away than the link length of either the parent or child nodes, then the mass and current velocity of the parent or child nodes need to be taken into account, to see how much each node is adjusted. Then if the parent node is repositioned, that could affect the link between it''s parent, so the order in which each node is updated comes into it as well. I don''t know if i''ve put it well, but I do know i''ve got a headache from this, is it possible to do ? Sorry for the long post. Jase

Share this post

Link to post
Share on other sites

  • 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!