guides:tips-on-quaternion
This is an old revision of the document!
Custom component : tips about quaternion
Assuming the local axis Y of the building is vertical (most cases), a way to compute the cosinus (named “cosp”) and sinus (named “sinp”) of the rotation angle of the building around the vertical is the following:
local q = self:getOwner():getGlobalOrientation() local sinp = 2 * q[4] * q[2] local cosp = q[4] * q[4] - q[2] * q[2]
Note: You can check that cosp*cosp + sinp*sinp is near 1
guides/tips-on-quaternion.1587597008.txt.gz · Last modified: 2020/04/22 19:10 by vjraymon