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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 01 January 2013   #1
Normal to Rotation with XPresso

Hello,

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

Günter
 
Old 01 January 2013   #2
hi,

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)
 
Old 01 January 2013   #3
Hi,

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.

Thanks
Günter
 
Old 01 January 2013   #4
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.

Günter
 
Old 01 January 2013   #5
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.
__________________
- www.bonkers.de -
The views expressed on this post are my personal opinions and do not represent the views of my employer.
 
Old 01 January 2013   #6
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 01:21 PM.


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