View Full Version : Normal to Rotation with XPresso
01-17-2013, 06:18 PM
I'm quite noobish concerning XPresso and think that this might be an easy task for most of you: I want the direction of a polygon normal to drive the rotation of another object. So that, for example, the Y Axis of my object is in line with the polygon normal.
The polygon node has a normal output which gives me a vector, I think. At least the result node shows me 3 different values, all between -1 and +1, depending on the rotation of the polygon.
How do I connect this vector to the HPB values of my object? I tried with the range mapper, p.ex. mapping the -1 to +1 values to -90 to +90 degrees... but this gives me strange results.
What's the best way to accomplish this task?
Thanks a lot
01-17-2013, 06:56 PM
a normalized vector has nothing to do with a rotation vector.
you will have to use a python node to use a helper function provided by the
utils class to calculate a HBPvector from a normal vector. i do not hink that
there is a preset for this.
from c4d import utils as u
HBPRotation = u.VectorToHPB(Normal)
01-17-2013, 07:25 PM
Thanks for the reply. I didn't think that I would have to use scripting for this - unfortunately I have practically zero experience with python and coding in general and thus try to avoid it.
I thought of it as a relatively easy task:
- the polygon normal points in a certain direction
- the Y axis of my object should point in the same direction
So I thought there must be some relatively simple way to connect both.
I'm looking into constraints now as I just have no clue about scripting.
01-17-2013, 07:28 PM
I just found out that the clamp constraint does exactly what I need.
Anyway, I'd still be interested if there's some way with XPresso.
The Vector2Matrix node converts the normal into a matrix, then feed the result in the Matrix2HPB node to get rotational values. Make sure to select the correct rotation system.
01-17-2013, 09:11 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.