|06-05-2012, 09:56 PM||#1|
Join Date: Sep 2006
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!
|06-05-2012, 10:19 PM||#2|
The Third Party
Join Date: Sep 2002
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.
|06-08-2012, 03:04 PM||#5|
Lord of the posts
Join Date: Sep 2003
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.
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|