Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Animating many objects through time
  RSS 2.0 ATOM  

Animating many objects through time
Rate this thread
 
63613
 
Permlink of this thread  
avatar
  • Total Posts: 21
  • Joined: 28 March 2007 10:57 AM

/* Is there any way to do this sequentially

so far i have got is this */

--slice modifier
for 1 to selection.count do 
(
local sliceMod sliceModifier Slice_Type:2
 local capMod 
Cap_holes ()
addModifier selection[i] sliceMod
 addModifier selection[i] capMod
with animate on
(at time (1+ (i*2)) sliceMod.Slice_Plane.pos [0,0,0]
at time 
((i*5) + 2sliceMod.Slice_Plane.pos [0,0,25])
)

--- i don’t know how to animate them sequenctially by name say box01 then box 02 and so on



3dmaxdesign 2011 64-bit
i7 2600 windows 7 64-bit
quadro 600

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Tip. Always wrap code inside CODE tags - the forum can mess scripts up so they can’t be copy/pasted (and then work if executed). Also, always state your Max version - put this in your sig so you can’t forget.

If you want the current selection sorted by name you need to manually sort it before iterating over it - selections are not guaranteed to be “in order” (actually, they tend to be in the order the objects where selected, which in tun depends on how they were selected).

(
fn SortFN V1 V2 
   (
   if 
V1.name V2.name then
      
-1
   
else
      
1
   
)

Selected selection as array
qsort Selected SortFN
   
for 1 to Selected.count do
   --
whatever you like here
)


Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Replies: 2
/img/forum/dark/default_avatar.png

Thanks for this!!!! works like a charm

_________________________________________________________________________________________

Max Design 2011
XP-64
Core 2 Duo Xeon 5160, 3.0 Ghz, 4 Gb Ram

Author: hanselmoniz

Replied: 16 January 2012 09:50 PM  
/img/forum/dark/default_avatar.png

That’s not a sig :P You have to set it in your user profile, then it will appear automatically (on posts, not on comments).

Author: Steve_Curley

Replied: 17 January 2012 12:33 AM  
avatar

Steve i was trying to set my user profile but am getting some error here at my workplace :( on the page dunno why

BTW the hint you gave me works fine but first i pick the objects to animate in order manually then i rename them after which i use the script



3dmaxdesign 2011 64-bit
i7 2600 windows 7 64-bit
quadro 600

Replies: 1
/img/forum/dark/default_avatar.png

Profile seems fine here - try setting it from home?

As for the order of selection - it’s basically a case of accounting for that odd occasion when you forget to select them in order, or when a co-worker “borrows” the script then claims it all goes wrong. It’s a (rather mild) example of Defensive Programming. Old habits die hard ;)

Author: Steve_Curley

Replied: 17 January 2012 08:54 PM