Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Random "Object" every frame or every other frame.

1 REPLY 1
Reply
Message 1 of 2
cpalmerCWG82
253 Views, 1 Reply

Random "Object" every frame or every other frame.

I am looking to accomplish something with MaxScript that is equivalent to random plane colors every frame <-- link. The difference is I want to change the object in every frame to something else. For instance. 

 

Off to the side I have outside of camera view the following shapes:

1. Cube

2. Square

3. Ball

4. Donut

 

I have 300 frames in my animation. In the center of camera view I would like for one of these objects to be placed randomly in the center or somewhere I can manipulate (move freely). 

 

Result

 

Frame 1 = Ball

Frame 2 = Donut

Frame 3 = Cube

etc...

 

How can I accomplish this? Open to using things outside of maxscripts also...

1 REPLY 1
Message 2 of 2
spacefrog_
in reply to: cpalmerCWG82

The first idea for me that comes to my mind for this task would be as follows:

 

  1. Add a substitute modifier to the main object
  2. Create an array that holds the references to the replacement objects
  3. on each frame change, pick a random element from the replacement objects array
  4. Set the substitude-modifier's ObjectReference property to the picked replacement object
  5. Success !

Josef Wienerroither
Software Developer & 3d Artist Hybrid

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report