# Normal to Rotation with XPresso

 01 January 2013 Theropoda Expert 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 share quote
 01 January 2013 littledevil Meh   portfolio Ferdinand Germany 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)`````` share quote
 01 January 2013 Theropoda Expert 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 share quote
 01 January 2013 Theropoda Expert 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 share quote
 01 January 2013 Srek Some guy   portfolio CGConnect Member Björn Dirk Marl Technical Design Maxon Computer GmbH Friedrichsdorf, Germany 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. share quote
 01 January 2013 CGTalk Moderation Expert 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. share quote

 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 vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.