Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to write max script to make animation which a object rotates about another object with curved motion path

How to write max script to make animation which a object rotates about another object with curved motion path

FelixP5NJM
Enthusiast Enthusiast
420 Views
2 Replies
Message 1 of 3

How to write max script to make animation which a object rotates about another object with curved motion path

FelixP5NJM
Enthusiast
Enthusiast

This is my code:

with animation on
(

    at time atFrame
(
	rotate $Top (AngleAxis rotateAngle [0,0,1])
	**in coordsys $Top about $Top.pos rotate $Module1 rotateAngle z_axis**
)

)
But it gives me a straight path. what max script should I write to make the path circular?

hengshuoP5NJM_1-1655930425135.png

Thank you!

 

0 Likes
Accepted solutions (1)
421 Views
2 Replies
Replies (2)
Message 2 of 3

denisT.MaxDoctor
Advisor
Advisor

sounds obvious... create a path controller (path_constarint) for the position and a look_at controller for the rotation, where the target is the node we're rotating around

0 Likes
Message 3 of 3

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

something like this:

delete objects

with redraw off
(
	trg = dummy name:#target boxsize:[10,10,10]
	src=point name:#source box:on axistripod:on cross:on size:20 wirecolor:orange
	
	sp = ellipse name:#path length:200 width:100 wirecolor:yellow
	converttosplineshape sp
	setKnotPoint sp 1 2 [0,100,30]
	setKnotPoint sp 1 3 [-50,0,50]
	setKnotPoint sp 1 4 [0,-120,20]
	updateshape sp

	path_control = path_constraint path:sp
	src.position.controller = path_control

	rot_control = lookat_constraint viewline_length_abs:off
	rot_control.appendTarget trg 1.0

	src.rotation.controller = rot_control
)		
	
0 Likes