Website URL

Skype

Name

Location

Interests

As I'm just starting to understand quaternions and orientation in Houdini, I'm not sure how complicated this is to achieve. I could be completely over thinking it.
Ultimately I would like to create a force in dops to rotate the packed object to its current direction of motion, or it's velocity. Modifying @w seems to be the best way to do that.
For a first step, I'm trying to make a setup that takes a rbd packed object and rotate it back to it's original orientation. While it technically does that, it doesn't do it logically. It flips around its axis in bizarre ways. As I understand, it's behaving erratically because it's trying to rotate around all of its axes at the same time.
This is the code I'm using in a pop wrangle node:
vector qToE(vector4 q_value){
float q_0 = q_value.w ;
float q_1 = q_value.x ;
float q_2 = q_value.y ;
float q_3 = q_value.z ;
vector out = {0,0,0} ;
out.x = atan2(2*(q_0*q_1+q_2*q_3), (1-2*(q_1*q_1+q_2*q_2))) ;
out.y = asin(2*(q_0*q_2-q_3*q_1)) ;
out.z = atan2(2*(q_0*q_3+q_1*q_2), (1-2*(q_2*q_2+q_3*q_3))) ;
return out ;
}
v@euler = qToE(@orient);
@w = -v@euler*1*{1,1,1};
This is where I got the quaternion to euler function:
I've attached my houdini file to this post. If anyone has any tips, I'd be very happy to hear them!
Thanks!
orient_rotate_v01.hip