How to know if a cylinder is lying or if it is right

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
jbosch
Posts: 43
Joined: Sat May 29, 2010 4:42 pm
Contact:

How to know if a cylinder is lying or if it is right

Post by jbosch »

Hi,

I need to know if some cyilnders are lying or they are right, any idea how to get this information from BEPU?

Thanks
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to know if a cylinder is lying or if it is right

Post by Norbo »

One way would be to check the entity's orientation matrix's up vector. If the dot product between its vector and Vector3.Up vector (which is equivalent to just the Y component of the matrix's up vector) is close to 1, then it's upright. If it's close to zero, then it's laying down. If it's close to -1, then it's upside down :)
jbosch
Posts: 43
Joined: Sat May 29, 2010 4:42 pm
Contact:

Re: How to know if a cylinder is lying or if it is right

Post by jbosch »

obvious :-P thanks!
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
Post Reply