PDA

View Full Version : Rotation of instanced particle objects


Tornado7
11-07-2009, 12:41 PM
Hi guys,

I have an instanced rock geometry on a particle object; I created the following creation expression to randomly orient my rock partibles when they are created:

float $rand_num_1 = rand (-360, 360);

float $rand_num_2 = rand (-360, 360);

debrisShape.rand_rot = <<$rand_num_1, 0, $rand_num_2>>;


I would like they can spin at runtime, increasing the x rotation for instance and the rotation can fade as the particles get older...I faced many problems to find a correct runtime expression...May you guys help me to find a solution for my problem?

Thanks in advance for any help ;)

spiderman3
11-07-2009, 03:24 PM
use a smoothstep function with age

Albo
11-07-2009, 03:30 PM
.
sorry.. my wrong post

Wick3dParticle
11-07-2009, 06:40 PM
Hi guys,

I have an instanced rock geometry on a particle object; I created the following creation expression to randomly orient my rock partibles when they are created:

float $rand_num_1 = rand (-360, 360);

float $rand_num_2 = rand (-360, 360);

debrisShape.rand_rot = <<$rand_num_1, 0, $rand_num_2>>;


I would like they can spin at runtime, increasing the x rotation for instance and the rotation can fade as the particles get older...I faced many problems to find a correct runtime expression...May you guys help me to find a solution for my problem?

Thanks in advance for any help ;)


Hi Francesco,

First of all, lets tak a look at your rand_rot expression. Instead of what you typed, you can put it in a shorter form like this:


debrisShape.rand_rot = <<rand(360), 0, rand(360)>>;

now in runtime, just to get you running...you can try something like this:
float $speedMult = 15;
debrisShape.rand_rot += (<<$speedMult,0,0>> * (1-(particleShape1.age/particleShape1.lifespan)));


Now if you want a bit more flexibility, you can create a new attribute called speedPP, and in creation assign that a random value. Then you can use that attribute to replace the $speedMult in the runtime expression.

I hope that gives you enough info to get what you are after.

Good luck!

~Ilan

stooch
11-07-2009, 08:10 PM
creation expression:
rotation = <<rand(-180,180),0,rand(-180,180)>>;

runtime expression:
$startFrame = 0;
$endFrame = 100;

$mult = 1 - smoothstep($startFrame, $endFrame, `currentTime -q`);
// what im doing here is inverting a smoothstep so that it reads 1 at frame 0
// and gradually reduces to 0 at frame 100 (note that im subtracting from 1)

rotation += <<1 * $mult,0,1 * $mult>>;
// as the $mult variable grows smaller it reduces the rotational offset ( note the +=)
// so as the end frame grows near, the offset dwindles down to 0 and items stop rotating.

I typed this off the top of my head, so didnt test it but it should get you started.

try using the linstep command if you dont want your rotation to ease in/out.
and hermite if you REALLY like control.


Hi guys,

I have an instanced rock geometry on a particle object; I created the following creation expression to randomly orient my rock partibles when they are created:

float $rand_num_1 = rand (-360, 360);

float $rand_num_2 = rand (-360, 360);

debrisShape.rand_rot = <<$rand_num_1, 0, $rand_num_2>>;


I would like they can spin at runtime, increasing the x rotation for instance and the rotation can fade as the particles get older...I faced many problems to find a correct runtime expression...May you guys help me to find a solution for my problem?

Thanks in advance for any help ;)

Tornado7
11-09-2009, 08:22 AM
Thanks a lot guys for your very detailed and useful replies! A special thanks to Ilan that he's helping me very much lately ;)

thanks again guys!!!

Francesco

CGTalk Moderation
11-09-2009, 08:22 AM
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.