PDA

View Full Version : instancer randomise using objectID


rapta
11-20-2006, 10:30 PM
hey, at the moment i am working on an explosion, and i have created 6 different pieces of geometry, to act as pieces of debris. when i instanced these pieces of geometry to my particle object it will by default use the piece of geometry at 'position 0' in the list of objects, what i was trying to do is have it randomly select what piece of geometry it will be at birth, i read you can do this using the ObjectID attribute, so i created a custom attribute with a creation expression to randomise this and then set ObjectID to get its input from this expression, but it kept telling me there was and executeable error on the particleShape! has anyone got this randomisation to work before? or know of how to get this to work?

the expression i used was;

int $particleChoice[] = rand(0,5);
particleShape2.particleSelect = $particleChoice[];

cheers

ChristopherP
11-21-2006, 09:23 AM
You'd be better off with creating a custom float PP-attribute (randomObjId) and then using this as the creation expression...
particleShape1.randomObjId = rand(0,5);

...if you have 4 pieces of geometry. You can then select the new attribute in the instancer's options.

Hope that helps


Christopher

rapta
11-21-2006, 10:02 PM
thanks ChristopherP, i set up that custom attribute, and used a floatpp expression that you recomended, and it is all worked fine, as expected, thankyou for your suggestion

cheers

rapta

CGTalk Moderation
11-21-2006, 10:02 PM
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.