View Full Version : instanced particle banking + velocity orient?
MrFace 01-12-2006, 11:55 PM does anyone know how to change the banking through a PP attribute that will retain the orientation from AimDirection=velocity?
|
|
MrFace
01-13-2006, 06:20 PM
here's what i've done to try and do this. it doesn't work, since velocity information doesn't directly translate to a rotation vector.
vector $velocityVar = particleShape1.velocity;
float $xrot = sin(time*2+particleShape1.particleId)*10;
particleShape1.randRotation = <<$xrot,$velocityVar.y,$velocityVar.z>>;
i've set rotation to randRotation in the instancer rotation options. this code makes the particle instances wobble like i want them to on their x, but velocity values are too small to make them change appreciably on their y and z, let alone orient them properly along their velocity vector.
MrFace
01-13-2006, 06:58 PM
this looks like the solution: http://forums.cgsociety.org/archive/index.php/t-199245.html
but i don't really know how to do it :cry: . any suggestions?
MrFace
01-13-2006, 11:24 PM
i've gotten ths far:
if (!!particleShape1.velocity) {
prevVelocity=<<.001,.001,.001>>;
};
vector $velocityVar = particleShape1.velocity;
vector $prevVelocityVar=particleShape1.prevVelocity;
float $xrotRand = sin(time*2+particleShape1.particleId)*20;
float $r=sqrt(pow($velocityVar.x,2)+pow($velocityVar.y,2)+pow($velocityVar.z,2));
float $z_theta = atan($velocityVar.y/$velocityVar.x);
float $y_phi = acos($velocityVar.z/$r);
float $prev_r=sqrt(pow($prevVelocityVar.x,2)+pow($prevVelocityVar.y,2)+pow($prevVelocityVar.z,2));
float $prev_z_theta = atan($prevVelocityVar.y/$prevVelocityVar.x);
float $prev_y_phi = acos($prevVelocityVar.z/$prev_r);
particleShape1.randRotation = <<$xrotRand,rad_to_deg($y_phi-$prev_y_phi),rad_to_deg($z_theta-$prev_z_theta)>>;
particleShape1.prevVelocity=particleShape1.velocity;
my little shapes seem to rotatin the right direction on the z, but not on the y. i dunno. very confused at this point.
ok i made things more complicated than i needed to. here's where i am. the particle instance does orient itself toward it's velocity vector:
vector $velocityVar = particleShape1.velocity;
float $xrotRand = sin(time*2+particleShape1.particleId)*20;
float $r=sqrt(pow($velocityVar.x,2)+pow($velocityVar.y,2)+pow($velocityVar.z,2));
float $z_theta = atan($velocityVar.y/$velocityVar.x);
float $y_phi = acos($velocityVar.z/$r);
particleShape1.randRotation = <<0,rad_to_deg($y_phi),rad_to_deg($z_theta)>>;
now if i can just make the thing wobble predictably using the $xrotRand, i'll be done!
CGTalk Moderation
01-13-2006, 11:24 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.