Ashasekayi (Talk | contribs) |
Ashasekayi (Talk | contribs) |
||
Line 8: | Line 8: | ||
local onStartMethod = function()<br> | local onStartMethod = function()<br> | ||
Space.Log(originalRot.'''x''');<br> | Space.Log(originalRot.'''x''');<br> | ||
− | ''-- prints the X | + | ''-- prints the X component of this object as a float''<br><br> |
originalRot.'''x''' = 0.25;<br> | originalRot.'''x''' = 0.25;<br> | ||
''-- assigns 0.25 value to the X rotation''<br><br> | ''-- assigns 0.25 value to the X rotation''<br><br> | ||
+ | obj.LocalRotation = originalRot;<br> | ||
+ | ''-- sets the the new component''<br> | ||
+ | end<br><br> | ||
+ | obj.OnStart(onStartMethod);}} | ||
+ | |||
+ | {{ScriptFunction|float|Y|{ get; set; }|Y axis|5= | ||
+ | local obj = Space.Host.ExecutingObject;<br> | ||
+ | local originalRot = obj.LocalRotation;<br> | ||
+ | obj.SubscribeToEvents();<br><br> | ||
+ | local onStartMethod = function()<br> | ||
+ | Space.Log(originalRot.'''y''');<br> | ||
+ | ''-- prints the Y component of this object as a float''<br><br> | ||
+ | originalRot.'''y''' = 0.25;<br> | ||
+ | ''-- assigns 0.25 value to the Y component''<br><br> | ||
obj.LocalRotation = originalRot;<br> | obj.LocalRotation = originalRot;<br> | ||
''-- sets the the new rotation''<br> | ''-- sets the the new rotation''<br> | ||
Line 16: | Line 30: | ||
obj.OnStart(onStartMethod);}} | obj.OnStart(onStartMethod);}} | ||
− | {{ScriptFunction|float| | + | {{ScriptFunction|float|Z|{ get; set; }|Z axis|5= |
− | + | local obj = Space.Host.ExecutingObject;<br> | |
− | {{ScriptFunction|float|W|{ get; set; }|W axis}} | + | local originalRot = obj.LocalRotation;<br> |
+ | obj.SubscribeToEvents();<br><br> | ||
+ | local onStartMethod = function()<br> | ||
+ | Space.Log(originalRot.'''z''');<br> | ||
+ | ''-- prints the Z component of this object as a float''<br><br> | ||
+ | originalRot.'''z''' = 0.25;<br> | ||
+ | ''-- assigns 0.25 value to the Z rotation''<br><br> | ||
+ | obj.LocalRotation = originalRot;<br> | ||
+ | ''-- sets the the new component''<br> | ||
+ | end<br><br> | ||
+ | obj.OnStart(onStartMethod);}} | ||
+ | |||
+ | {{ScriptFunction|float|W|{ get; set; }|W axis|5= | ||
+ | local obj = Space.Host.ExecutingObject;<br> | ||
+ | local originalRot = obj.LocalRotation;<br> | ||
+ | obj.SubscribeToEvents();<br><br> | ||
+ | local onStartMethod = function()<br> | ||
+ | Space.Log(originalRot.'''w''');<br> | ||
+ | ''-- prints the W component of this object as a float''<br><br> | ||
+ | originalRot.'''w''' = 0.25;<br> | ||
+ | ''-- assigns 0.25 value to the W component''<br><br> | ||
+ | obj.LocalRotation = originalRot;<br> | ||
+ | ''-- sets the the new rotation''<br> | ||
+ | end<br><br> | ||
+ | obj.OnStart(onStartMethod);}} | ||
==Constructors== | ==Constructors== |
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 component 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 component
end
Y axis
local originalRot = obj.LocalRotation;
obj.SubscribeToEvents();
local onStartMethod = function()
Space.Log(originalRot.y);
-- prints the Y component of this object as a float
originalRot.y = 0.25;
-- assigns 0.25 value to the Y component
obj.LocalRotation = originalRot;
-- sets the the new rotation
end
Z axis
local originalRot = obj.LocalRotation;
obj.SubscribeToEvents();
local onStartMethod = function()
Space.Log(originalRot.z);
-- prints the Z component of this object as a float
originalRot.z = 0.25;
-- assigns 0.25 value to the Z rotation
obj.LocalRotation = originalRot;
-- sets the the new component
end
W axis
local originalRot = obj.LocalRotation;
obj.SubscribeToEvents();
local onStartMethod = function()
Space.Log(originalRot.w);
-- prints the W component of this object as a float
originalRot.w = 0.25;
-- assigns 0.25 value to the W component
obj.LocalRotation = originalRot;
-- sets the the new rotation
end
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)
|