Normal to Rotation with XPresso

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  01 January 2013
Normal to Rotation with XPresso


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 January 2013

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.

import c4d
from c4d import utils as u
HBPRotation = u.VectorToHPB(Normal)
  01 January 2013

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 January 2013
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.

  01 January 2013
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.
- -
The views expressed on this post are my personal opinions and do not represent the views of my employer.
  01 January 2013
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:56 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.