|
|
(38 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | The SVector struct contains a simple 3D vector of X, Y and Z floats
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/svector |
− | | + | |
− | ==Fields==
| + | |
− | {{ScriptFunction|float|X|{ get; set; }|X axis (red axis)}}
| + | |
− | {{ScriptFunction|float|Y|{ get; set; }|Y axis (green axis)}}
| + | |
− | {{ScriptFunction|float|Z|{ get; set; }|Z axis (blue axis)}}
| + | |
− | | + | |
− | ==Constructors==
| + | |
− | {{ScriptFunction|SVector|__new|(float x, float y, float z)|Initialises vector from three floats}}
| + | |
− | | + | |
− | ==Members==
| + | |
− | Note: Add/Scale/Divide are also implemented as operators (e.g. A + B, A += B)
| + | |
− | | + | |
− | {{ScriptFunction|SVector|Add|(SVector other);|Adds another vector to this, and returns the result}}
| + | |
− | {{ScriptFunction|SVector|Add|(float other);|Adds a float to each axis of this, and returns the result}}
| + | |
− | {{ScriptFunction|SVector|Scale|(SVector other);|Multiplies another vector to this, and returns the result}}
| + | |
− | {{ScriptFunction|SVector|Scale|(float other);|Multiplies a float to each axis of this, and returns the result}}
| + | |
− | {{ScriptFunction|SVector|Divide|(SVector other);|Divides another vector to this, and returns the result}}
| + | |
− | {{ScriptFunction|SVector|Divide|(float other);|Divides a float to each axis of this, and returns the result}}
| + | |
− | {{ScriptFunction|float|Magnitude|{ get ; }|Returns the magnitude of this vector}}
| + | |
− | {{ScriptFunction|SVector|Normalised|{ get ; }|Returns the normalised version of this vector}}
| + | |
− | {{ScriptFunction|float|Distance|(SVector other);|Returns the distance between this vector and other in meters}}
| + | |
− | {{ScriptFunction|float|SquareDistance|(SVector other);|Returns the square of the distance between this vector and other in meters, considerably faster than distance()}}
| + | |
− | {{ScriptFunction|bool|InRange|(SVector other, float range);|Returns if other is within range meters of this vector, inclusive}}
| + | |
− | {{ScriptFunction|SVector|Cross|(SVector other);|Returns the cross product of this vector and other}}
| + | |
− | {{ScriptFunction|SVector|Lerp|(SVector other, float t);|Linear interpolates between this and other based on factor t (0..1)}}
| + | |
− | {{ScriptFunction|SVector|Slerp|(SVector other, float t);|Spherically linear interpolates between this and other based on factor t (0..1)}}
| + | |
− | {{ScriptFunction|SVector|MoveTowards|(SVector other, float maxDistance);|Moves this vector closer to other by a maximum of maxDistance units}}
| + | |
− | {{ScriptFunction|float|Dot|(SVector other);|Returns the dot product between this and other (note - normalise your vectors first!)}}
| + | |
− | | + | |
− | ==Static Members==
| + | |
− | {{ScriptFunction|SVector|Up|{ get; }|Equivalent of new SVector(0,1,0)}}
| + | |
− | {{ScriptFunction|SVector|Down|{ get; }|Equivalent of new SVector(0,-1,0)}}
| + | |
− | {{ScriptFunction|SVector|Left|{ get; }|Equivalent of new SVector(-1,0,0)}}
| + | |
− | {{ScriptFunction|SVector|Right|{ get; }|Equivalent of new SVector(1,0,0)}}
| + | |
− | {{ScriptFunction|SVector|Forward|{ get; }|Equivalent of new SVector(0,0,1)}}
| + | |
− | {{ScriptFunction|SVector|Back|{ get; }|Equivalent of new SVector(0,0,-1)}}
| + | |
− | {{ScriptFunction|SVector|Zero|{ get; }|Equivalent of new SVector(0,0,0)}}
| + | |
− | {{ScriptFunction|SVector|One|{ get; }|Equivalent of new SVector(1,1,1)}}
| + | |
− | {{ScriptFunction|SVector|MinValue|{ get; }|Contains the largest possible negative vector}}
| + | |
− | {{ScriptFunction|SVector|MaxValue|{ get; }|Contains the largest possible vector}}
| + | |
− | | + | |
− | {{Scripting Navbox}}
| + | |