CGTalk > Software Specific Forums > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 06-05-2012, 09:56 PM   #1
Rusherific
New Member
Devin Earthman
Berkeley, USA
 
Join Date: Sep 2006
Posts: 12
How can I use xpresso to find if an object is pointing up

Hi all, I use a fair amount of xpresso but rarely involving vectors and vector math as I tend to cry in the corner when I hear those words. What I have is a cube with dynamics and separate surfaces and would like to be able to know which side is facing up throughout my animation so I can change surface properties as it tumbles. I understand the basics that I should be able to look at either the cube's normals, or each sides orientation and compare it to the Y axis to see the difference in angle but I have no idea how to go about that...

Any help would be much appreciated!

Cheers
 
Old 06-05-2012, 10:19 PM   #2
Per-Anders
helper bunny
 
Per-Anders's Avatar
CGTalk Forum Leader
portfolio
Per-Anders Edwards
Developer
The Third Party
USA
 
Join Date: Sep 2002
Posts: 12,708
To calculate the "facing ratio" i.e. how much something faces a direction, you just do a dot product of the two vectors. Don't panic, there's a node for this, just plug your two vectors in and you'll get a float/real out. If the result is positive then the two vectors are facing towards the same way (ish), well anywhere from parallel to perpendicular in the same direction.

If you want more than just do they face towards/away then you should normalize the vectors first and the result will be closer to 1.0 the more aligned the vectors are, and closer to -1.0 the more they go in an opposite direction, and of course closer to 0.0 when they're perpendicular.

If you then want the actual angle between the two vectors you just put the result through an Arc Cosine.
__________________
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
 
Old 06-07-2012, 06:25 PM   #3
Rusherific
New Member
Devin Earthman
Berkeley, USA
 
Join Date: Sep 2006
Posts: 12
Hey Per-Anders, thanks a ton for the response, clearly I need to buckle down one of these days and learn more about it myself!
 
Old 06-08-2012, 03:04 PM   #4
fuat
Expert
 
fuat's Avatar
Fuat Yüksel
FX TD
Trixter
Munich, Germany
 
Join Date: Jan 2006
Posts: 619
don´t be scared from vector math - once you touch it, you´ll never want to lose it again....
cheers
fuat
 
Old 06-08-2012, 03:04 PM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:23 PM.


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