
Direction to Rotation
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Direction to Rotation
That is a cool node. Does someone knows the math behind it? Or how it called in mathematical term?


-
Mathaeus
- Posts: 1778
- Joined: 08 Jun 2009, 19:11
- Location: Zagreb, Croatia
Re: Direction to Rotation
I'd believe it's Rotation_matrix. Btw well known Isner's page about rotations in XSI seem to be still alive.
Yeah it's cool, just as direction constrain from standard XSI kinematics.
Yeah it's cool, just as direction constrain from standard XSI kinematics.
-
csaez
- Posts: 253
- Joined: 09 Jul 2012, 13:31
- Skype: csaezmargotta
- Location: Sydney, Australia
Re: Direction to Rotation
I think it's doing a simple cross product to get the 3 axes and construct a rotation matrix with them.
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: Direction to Rotation
Thanks, Mathaeus! Will read it laterMathaeus wrote:I'd believe it's Rotation_matrix. Btw well known Isner's page about rotations in XSI seem to be still alive.
Yeah it's cool, just as direction constrain from standard XSI kinematics.
Yea, it's an obvious part, but how did it gets second vector for cross product?csaez wrote:I think it's doing a simple cross product to get the 3 axes and construct a rotation matrix with them.
The only way to get two vectors from one position I can see so far is to get the vectors from global center. One for current position of the object, second is for Point At vector. Since they're should't be placed at the same place we will always get the offset which leads us to bi-normal of the object. In cases when they're placed on one axis we apply special case for each of the planes. Right? It is working, but the order of flipping is not matched with the Direction to Rotation node, so it would be great to know how it's actually calculated inside...

You do not have the required permissions to view the files attached to this post.
-
Mathaeus
- Posts: 1778
- Joined: 08 Jun 2009, 19:11
- Location: Zagreb, Croatia
Re: Direction to Rotation
In ICE node, both vectors are directions, "point at" is a bit confusing. At least, I've used this node in this way. Kristinka Hair is full of this node. For "point at" should be some subtract or like. So most likely it is, probably, two cross-products for conversion into rotation matrix - first to find third vector, second to line up the "up vector" direction.iamVFX wrote: The only way to get two vectors from one position I can see so far is to get the vectors from global center. One for current position of the object, second is for Point At vector.
-
Falam
Re: Direction to Rotation
This could be a thread on asking questions about each individual node in ICE and how it works etc.
-
face
- Posts: 57
- Joined: 10 Jan 2010, 11:28
Re: Direction to Rotation
Have made a c++ function with the SDK. I thing the compound will work the same...
face
face
Code: Select all
void LookAt(CVector3 dir, CVector3 up, CMatrix3& m)
{
CVector3 z(dir);
z.NormalizeInPlace();
CVector3 x;
x.Cross(up, z);// x = y cross z
x.NormalizeInPlace();
CVector3 y;
y.Cross(z, x); // y = z cross x
m.SetValue(0,0,x[0]);
m.SetValue(0,1,x[1]);
m.SetValue(0,2,x[2]);
m.SetValue(1,0,y[0]);
m.SetValue(1,1,y[1]);
m.SetValue(1,2,y[2]);
m.SetValue(2,0,z[0]);
m.SetValue(2,1,z[1]);
m.SetValue(2,2,z[2]);
}
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: Direction to Rotation
Thank you, Stephan! This is exactly what I was looking forface wrote:Have made a c++ function with the SDK. I thing the compound will work the same...
faceCode: Select all
void LookAt(CVector3 dir, CVector3 up, CMatrix3& m) { CVector3 z(dir); z.NormalizeInPlace(); CVector3 x; x.Cross(up, z);// x = y cross z x.NormalizeInPlace(); CVector3 y; y.Cross(z, x); // y = z cross x m.SetValue(0,0,x[0]); m.SetValue(0,1,x[1]); m.SetValue(0,2,x[2]); m.SetValue(1,0,y[0]); m.SetValue(1,1,y[1]); m.SetValue(1,2,y[2]); m.SetValue(2,0,z[0]); m.SetValue(2,1,z[1]); m.SetValue(2,2,z[2]); }
Yes, Mathaeus, you're right, two cross products, and it works exactly like Direction to Rotation compoundMathaeus wrote:So most likely it is, probably, two cross-products for conversion into rotation matrix - first to find third vector, second to line up the "up vector" direction.
Thanks to everyone, guys, I love you
-
dwigfor
- Posts: 395
- Joined: 17 Nov 2009, 16:46
Re: Direction to Rotation
I thought I tried recreating LookAt function with that double cross product method, and encountered weird flipping issues around poles. Then I discovered that Direction to Rotation node which didn't seem to have that problem.
Or maybe that was when I tried using arctan2, axis and angle.... Any flipping problems you've encountered?
Or maybe that was when I tried using arctan2, axis and angle.... Any flipping problems you've encountered?
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: Direction to Rotation
No... Try it yourself, maybe I missed somethingdwigfor wrote:Any flipping problems you've encountered?
You do not have the required permissions to view the files attached to this post.
