[Closed] Animating spline vertics
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
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
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 .
A curve is not a spline …
Georg
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…