Rotation direction not as expected

I’m trying to get the orientation/direction of an object in degrees, using a data block and a rotation/direction block:

I expect the output of the z direction to be either 0 or 180, but this is not what I’m getting.

Is this a bug, or am I not understanding the internals of rotation/direction? See for details.

Thanks in advance!

Hi @techleapnz,

the direction is a three-dimensional normalised vector where the object faces.
This are the conditions for four main directions:
The 0.99 is set because the result of the floating point calculations can be not exactly 1, but a very close number. You can increase this number for accuracy increase.
If you want to calculate angles between directions and vectors, you can use the typescript methods of the Vector3 class in scripting tab.

Hope that helps. If you have any questions, feel free to ask

Thanks @Nikolay. I think this is confusing for students, as Rotation is shown in degrees for each object in the 3D editor, there is no display of the normalised vector for the object, and there is no tooltip on the CoBlock to indicate what the output is, and no help documentation.


This is further confused by allowing objects to move “forward”, “backward” etc.

I suggest either converting the output of the direction CoBlock to be in degrees, or adding a rotation CoBlock under the rotation section, or displaying the Rotation of objects using the normalised vector plus providing documentation on what that is. The first option is my preference, as this is simpler to understand for students - normalised vectors is pretty advanced stuff!

Consider this a feature request :slight_smile:

UPDATE: ok, so after looking into the complexity of Vector3 and local/global, position, direction, origin, normalised vectors etc I now have more insight. The tricky part for you is taking this complexity and simplifying it or making it accessible for students - I believe including the Rotation in degrees is good way to do this.

Q: the direction value seems global - is that correct?

1 Like

Thank you for your ideas and request! We will discuss it and think what can be done.


Yep, it will require considerable discussion to get a unified approach. My suggestion is to keep complexity for use with Javascript.


Again, I think this needs documentation, consistency, or options to allow local/global.