How can I reorient the axes of an object?

Posted by d3vid on Game Development See other posts from Game Development or by d3vid
Published on 2014-04-10T08:23:46Z Indexed on 2014/06/09 21:42 UTC
Read the original article Hit count: 464

Filed under:
|
|

I spent some time in Unity yesterday trying to fire a sphere from a horizontal cylinder (like a ball from a cannon). I was using Vector3.forward, but the sphere kept coming out the top of the cylinder rather than the front. Someone suggested using Vector3.up instead, and sure enough it worked!

The cylinder is vertical by default. So, it appears that when I rotated the cylinder by 90 degrees to lay it flat, the local axes remained the same. The relative front of the cylinder remained at the same point, so when I fired the sphere it shot out the new "top", not what looked to me like the "front". If I had happened to be facing the other way, I would have had to fire at Vector3.down instead.

How can I reorient/reset the axes of an object so that they match my expectations? (And if I can't, how can I tell by looking which way an object is oriented?)

© Game Development or respective owner

Related posts about unity

Related posts about orientation