(Created page with "The SQuaternion struct contains a simple 4D vector of X, Y, Z and W floats designed to represent rotations with orientation. ==Fields== {{ScriptFunction|float|X|{ get; set; }...") |
Ashasekayi (Talk | contribs) |
||
Line 2: | Line 2: | ||
==Fields== | ==Fields== | ||
− | {{ScriptFunction|float|X|{ get; set; }|X axis}} | + | {{ScriptFunction|float|X|{ get; set; }|X axis|5= |
+ | local obj = Space.Host.ExecutingObject;<br> | ||
+ | local originalRot = obj.LocalRotation;<br> | ||
+ | obj.SubscribeToEvents();<br><br> | ||
+ | local onStartMethod = function()<br> | ||
+ | Space.Log(originalRot.'''x''');<br> | ||
+ | ''-- prints the X rotation of this object as a float''<br><br> | ||
+ | originalRot.'''x''' = 0.25;<br> | ||
+ | ''-- assigns 0.25 value to the X rotation''<br><br> | ||
+ | obj.LocalRotation = originalRot;<br> | ||
+ | ''-- sets the the new rotation''<br> | ||
+ | end<br><br> | ||
+ | obj.OnStart(onStartMethod);}} | ||
+ | |||
{{ScriptFunction|float|Y|{ get; set; }|Y axis}} | {{ScriptFunction|float|Y|{ get; set; }|Y axis}} | ||
{{ScriptFunction|float|Z|{ get; set; }|Z axis}} | {{ScriptFunction|float|Z|{ get; set; }|Z axis}} |
The SQuaternion struct contains a simple 4D vector of X, Y, Z and W floats designed to represent rotations with orientation.
X axis
local originalRot = obj.LocalRotation;
obj.SubscribeToEvents();
local onStartMethod = function()
Space.Log(originalRot.x);
-- prints the X rotation of this object as a float
originalRot.x = 0.25;
-- assigns 0.25 value to the X rotation
obj.LocalRotation = originalRot;
-- sets the the new rotation
end
Y axis
Z axis
W axis
Initialises quaternion from four floats
Creates a quaternion from 3 Euler floats (i.e. 3x 0-360' angles)
Creates a quaternion from a Angle / Axis pair
Creates a quaternion a forward vector; presuming up is (0,1,0)
Creates a quaternion a forward and up vector pair
Note: Add/Scale/Divide are also implemented as operators (e.g. A + B, A += B)
Returns the Euler rotation for this Quaternion
Rotates a vector by a quaternion
Rotates a quaternion by a quaternion
Returns the angle between two quaternions
Linearly interpolates between this and other quaternion, by factor t and returns the result
Spherically interpolates between this and other quaternion, by factor t and returns the result
Rotates this towards other, by no more than t degrees
Returns the dot product of this and another quaternion
Returns the inverse of this quaternion
Equivalent of new SQuaternion(0,0,0,1)
|