PDA

View Full Version : Animating Splines with IntersectRay?


bnvm
09-30-2005, 11:28 PM
I am trying to animate a spline by moving knots to an objects surface by clicking it with a mouse. I can move the knots to the objects surface using setKnotPoint and IntersectRay but when I try to assign that position to a keyframes value the knot doesn't go to the right position anymore. I imagine that it has something to do with the coordsys but I'm not sure and not very good at working with transform matrices. Any help would be great. Thanks,

-bnvm

Bobo
09-30-2005, 11:39 PM
I am trying to animate a spline by moving knots to an objects surface by clicking it with a mouse. I can move the knots to the objects surface using setKnotPoint and IntersectRay but when I try to assign that position to a keyframes value the knot doesn't go to the right position anymore. I imagine that it has something to do with the coordsys but I'm not sure and not very good at working with transform matrices. Any help would be great. Thanks,

-bnvm

Is the spline linked (parented) to something?
Keyframes store animation in parent space, so if the parent is not the world, the keyframe values would not be in world space anymore.

You can always transform out of parent space by multiplying the positions by the inverse of the parent node's transformation matrix, but if the spline can be unparented, it might be easier...

bnvm
10-02-2005, 04:36 AM
No nothing in the scene is parented. I have done some testing and if I apply a value like [10,10,10] to the keyframe and check it afterwards it says that its is [10,10,10] but when I check its world space coordinates it is not the same value. This is very strange since I took the code from another script that I wrote that also uses intersectRay to find the position to move the knot to. The only difference in this case is that the ray is being fired from the mouse rather that another object in the scene. My code for setting the keys is all based off an example that I found on this site written by you, Bobo. As of now I am stumped.

bnvm
10-03-2005, 03:57 PM
It looks like I got it working. I needed to transform the intersectRay position in to the splines object space. I just multiplied the value from the intersectRay operation by the inverse of the splines transform and it seems to be working now. Thanks for the help.

CGTalk Moderation
10-03-2005, 03:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.