# Rotation matrix?

#### Netvudu

##### Senior Constrictor
Hi.
i was trying to adapt a displacement technique from some other software and found a problem, because we don´t have a rotation Matrix node.
Namely I want to input an angle, use a vector (let´s say 0,0,1) for the direction and get a matrix that I can multiply by something else.

Any math wizzs that suggest a viable alternative?

#### omichon

##### Member
As far as I remember, Poly2Poly has a rotate Matrix node in his Math nodes.

#### Sensei

##### TrueArt Support
we don´t have a rotation Matrix node

We don't have?

Math > Vector > Multiply Matrix 3x3
Math > Vector > Transform2
Math > Vector > HBPMatrix

#### Tobian

##### New member
Nope we don't. We need a node which transforms rotation into translation. Sure for a simple angle of 45 degrees it's just 1,1 then normalise, but arbitrary angles will be hard to calculate.

#### Sensei

##### TrueArt Support
Matrix 3x3 is triplet right, up, forward vectors.

#### RebelHill

##### Goes bump in the night
use HPB matrix and matrixHPB to go the other way.

#### Mr. Wilde

##### Member
A scripting node would be a neat feature for stuff like that. Add as much inputs as you want, add as much outputs as you want, and then you write a Python script to handle inputs and outputs.

Last edited:

#### probiner

##### F&#559;rum Mole
Well things aren't very clear in LW. The other day I was trying to make Part Move normals to "Look At" to another object and while my linear algebra is bad that's something that took 2 min to figure out in Softimage ICE. Given though that ICE has some nodes and data structure that in LW seems to be... all blue inputs. Are these all vectors only? Dunno. In ICE you have 4x4 matrix in blue teal (No such things in LW seems), 3x3 matrix darker blue teal (which is Right, Up, Forwad Matrix in LW) and the there's also beyond Euler there's also Rotation bright blue (Axis + Angle). To help to that there's also a Rotate Vector node. Where you input your vector to be rotated, the vector to serve as axis and the angle. I could not replicate this in LW so far. Also there's no "Angle Between" even though Dot + ArcCos does the same. It's all these things that make a differences if you kind of get the logic to get somewhere but you don't actually know the math to get there.

As for "look at" in ICE was fairly simple. Cross Product (PolygonNormalVector x Vector(Normalize(Nulll.pos - Polygon.pos)) which defines the axis of rotation. Dot Product of the same 2 vectors * ArcCos defines the angle between them. Plug both into Rotate Vector and you have the normals rotating to align to the object, which can be animated if you interpolate from 0 to the Angle Between them. Do I know everything thing going under the hood? No. But it was fairly easy to foresee what I needed and get there.

Can it be done in LW. Why not? I just don't have a clue why, nor feel the nodes in place or the way the data structure is presented that it helps. Plus things like Displacement are always done as Delta. And sometimes you just want the absolute thing. Sure one can subtract... it's just gaahh...

Cheers

Last edited:

#### probiner

##### F&#559;rum Mole
Finally got something with Part Move due to Poly2Poly's "Rotate Vector". There's still some spinning around the normal that I should fix.

http://screencast.com/t/lsaVYunPv4P9

Cheers

Last edited: