Skip to main content
GameDev.net gamedev.net
🔒 Locked

Proper bone orientation using rope physics (twist issues)

Started by nutso May 24, 2012 at 4:48 PM 1 replies 1.2k views
Original Post
nutso
nutso
I've been following the nehe tutorial on rope physics using the spring-mass system. The particles move around just fine. However, I'd like to use this to drive an actual 3d model, which means positioning and rotating weighted joints on the model.

Can anyone suggest some ways to construct the rotation matrix for the joints? I've tried a few different ways to construct a look-at matrix at each joint using the next particle in the chain, but I occasionally run into twist issues, where the model completely twists around and creates an odd taper-like effect at the joint.

Thanks in advance for help.
apatriarca
apatriarca

[font=arial, sans-serif]A more complete description of the method I'm going to discuss in this post can be found in the following paper: www.cs.indiana.edu/pub/techreports/TR425.pdf I invite you to read the paper for more information.[/font]

[font=arial, sans-serif]The usual mathematical method to associate a frame to each point of a curve is the Frenet frame method which is based on differential quantities. The main problem of this method is that the frame may switch orientation at singular points of the curve. This is the problem you are probably observing. Moreover, the Frenet frame is not defined on singular points. [/font]
[font=arial, sans-serif]The solution is to be somewhat more "conservative" on the choice of the frame. The parallel transport method choose the normal and binormal so that the frame is as similar as possible to the previous (or next if you are moving backwards) one. You first define the tangent vector using any method you prefer (for example the normalized difference between the next and previous point or something similar). You then compute the binormal vector as the cross product of the current tangent and the previous one [/font][font=arial, sans-serif](in case you are computing everything backwards you should probably use the next tangent and swap the order of the two vectors)[/font][font=arial, sans-serif]. If the two tangents were parallel, the norm of the binormal is zero and you should then copy the previous normal and binormal. If the norm of the binormal is not zero, you can then compute the angle between the two tangents and rotate the previous normal by that angle between the binormal. A pseudocode can be found in the previously linked paper. You should the transform the frame in a rotation matrix. Let me know if you need help in this last step.[/font]

nutso
nutso
Thanks, apatriarca! That works well and removes the pinching.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.