PDA

View Full Version : Animating spline vertics


Arakaz
02-06-2005, 10:05 PM
Is someone here who knows how to animate vertics of a simple line spline?????
I tried it with "animate at ..." and then define the position but it doesnt work....:(

Bobo
02-07-2005, 01:43 AM
Is someone here who knows how to animate vertics of a simple line spline?????
I tried it with "animate at ..." and then define the position but it doesnt work....:(

Normally, EditableSpline and EditableMesh do not have default controllers assigned to their vertices (to save memory and for performance reasons).
You have to assign the animation controllers explicitly before animating the vertices.

Here is a low-level example of a possible way - this same way allows you to also set the animation of the in and out tangents! (the knot has an offset of 2, the inVec is 1st, the outVec is 3rd.

sp = SplineShape() --create a spline shape
addNewSpline sp --add a new spline
addKnot sp 1 #corner #line [0,0,0] --set the first knot at origin
addKnot sp 1 #corner #line [100,0,0] --set the second knot 100 units away
updateShape sp --update the spline

animateVertex sp #all --create animation tracks for all knots
theKnotIndex = 2 --the knot to animate

--calculate the track index inside the Master controller, +2 is the offset of knots
--inside the master point controller. Use +1 for inTangents and +3 for outTangents:
theTrackIndex = 3*(theKnotIndex-1)+2
theKey = addNewKey sp[4][4][theTrackIndex].controller 0 --set a key on frame 0
theKey = addNewKey sp[4][4][theTrackIndex].controller 100 --set a key on frame 100
theKey.value = [100,100,100] --set the second key's value on frame 100

Arakaz
02-11-2005, 09:35 AM
thank you very much... this worked very well :)

rdg
07-07-2005, 07:30 AM
Hello,

sp[4][4] didn't work for me, as this seems to be SubAnim:render_width.

-- Unknown property: "controller" in undefined
-- Unknown property: "controller" in undefined

sp[4][8] pointed to the master control.

I also noticed that the mastercontroller added with animatevertex() is not taken into account when getting the number of subanimations with sp[4].numSubs.

Probably totaly overdose:

fn getSubAnimIndexByName obj wishSubAnim = (
saCount=obj.numSubs
for i = 1 to saCount+2 do(
try(
currentSubAnim=obj[4][i].name
-- print (i as string +" ... "+currentSubAnim)
if wishSubAnim==(currentSubAnim as string) then return i
)catch()
)
)

print (getSubAnimIndexByName sp "Master")

Does the index of SubAnims change bitween versions of max?

Georg

salmonmoose
07-07-2005, 07:48 AM
Is there a reason why you can't use splineIK?

rdg
07-07-2005, 08:13 AM
I don't think so. SplineIK is another mistery.

I was trying to animate the mixcurve of a falloff material.

Neither splineIK nor vertexAnimate helps images/icons/icon9.gif.

A curve is not a spline ...


Georg

Bobo
07-08-2005, 12:38 AM
Hello,
Does the index of SubAnims change bitween versions of max?


Could it be that you are using Max 7.5?
Splines have changed radically in it, with lots more settings for renderable cross-section with option for rectangular cs with widht and length and much more. It would explain why you are getting a different subanim in your case...

rdg
07-08-2005, 06:45 AM
Could it be that you are using Max 7.5?
....
It would explain why you are getting a different subanim in your case...

Yes, I do.
I will keep this in mind.
Thank you.


Georg

CGTalk Moderation
07-08-2005, 06:45 AM
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.