How to aim nParticles Instances WITH ROLL using mel expression


I’m pretty sure I need to query positions per frame and derive a vector, but it’s very hard to find info for this. I’m using velocity in the Aim Direction which works for pitch and Yaw, but not roll. I’m not sure how to query the PP positions between 2 frames and pipe that into the local X rot. I was thinking maybe I could query the Y value being driven by Aim Direction (Velocity) and use that value in the Roll with a multiplier, but I suspect the rotation attr and aim Direction attr would compete so I’d likely need to query vectors to drive all the rots. I’m not sure.

I have a tutorial that uses Aim and then derives up axis from surface normal,… but I need to derive up axis from particle instanced object at time… I think.

Any help would be appreciated, thanks so much!


I keep finding this which I think is what I need , however It’s not working for me…

vector $velocity = particleShape1.velocity;
float $angBet[] = angleBetween -euler -v1 1 0 0 -v2 ($velocity.x) ($velocity.y) ($velocity.z);
particleShape1.rotPP = << $angBet[0] , $angBet[1], $angBet[2] >> ;

I’ve read this will do the same thing as aim direction, so perhaps if I duplicate this for the Y and Z I’ll get what I need or I just change the first vector flag to 1 1 1 , but yeah I created this in creation and runtime expression and changed Aim Direction to rotPP and it doesn’t do anything, also tried just using the rotaiton pulldown with rotPP and nothing.