Arma Reforger Script API
Loading...
Searching...
No Matches
SCR_Math3D Interface Reference

Contains various scripted 3D math functions. More...

Static Public Member Functions

static vector GetFixedAxisVector (vector toFlip)
 Flips X and Y axis of the vector.
 
static void RotateTowards (out float result[4], float from[4], float to[4], float maxDegreesDelta)
 Rotates the input from rotation to the input to rotation by a maximum of maxDegreesDelta.
 
static vector MoveTowards (vector start, vector target, float maxDistanceDelta)
 Moves a point start in a straight line towards a target point.
 
static vector FixEulerVector (vector angles, float units=Math.PI)
 Ensures the angles are in range <-units; +units>
 
static vector FixEulerVector180 (vector angles)
 Ensures the angles are in range <-180; +180>
 
static void Extrapolate (IEntity entity, Physics physics, vector netPosition, vector netVelocityLinear, float netTeleportDistance, float netRotation[4], vector netVelocityAngular, float netTeleportAng, float timeSinceLastTick, float timeSlice, float netTickInterval)
 
static vector IntersectPlane (vector rayPos, vector rayVector, vector planePos, vector planeNormal)
 Get intersection between a line and a plane.
 
static bool MatrixEqual (vector matrixA[4], vector matrixB[4])
 Check if two matrices are equal.
 
static bool IsMatrixEmpty (vector matrix[4])
 Check if matrix is empty.
 
static bool IsMatrixIdentity (vector matrix[4])
 Check if matrix is identity matrix (right, up, forward, zero vectors)
 
static vector Min (vector vA, vector vB)
 Return the smallest from each vector value.
 
static vector Max (vector vA, vector vB)
 Return the largest from each vector value.
 
static float GetDistanceFromSpline (notnull array< vector > points, vector point)
 Gets the shortest 3D distance between a point and a spline.
 
static float GetDistanceFromSplineXZ (notnull array< vector > points, vector point)
 Gets the shortest 2D distance between a point and a spline.
 
static bool IsPointWithinSplineDistance (notnull array< vector > points, vector point, float distance)
 Check if point is within provided 3D distance from the shape - faster than getting distance then comparing.
 
static bool IsPointWithinSplineDistanceXZ (notnull array< vector > points, vector point, float distance)
 Check if point is within provided 2D distance from the shape - faster than getting distance then comparing.
 
static void QuatAngleAxis (float angle, vector axis, out float quat[4])
 Get a rotation that rotates angle (rad) around the provided axis.
 
static vector QuatMultiply (float quat[4], vector vec)
 Rotates provided vector by given quaternion.
 
static void RotateAround (vector transform[4], vector pivot, vector axis, float angle, out vector result[4])
 Rotates a transformation around the provided pivot point by angle (rad) around the axis.
 
static void LookAt (vector source, vector destination, vector up, out vector rotMat[4])
 Returns a rotation matrix that makes object positioned at source position face the point at destination.
 
static vector ClampMagnitude (vector v, float magnitude)
 Returns the provided vector clamped to desired magnitude.
 

Detailed Description

Contains various scripted 3D math functions.

Member Function Documentation

◆ ClampMagnitude()

static vector SCR_Math3D.ClampMagnitude ( vector v,
float magnitude )
static

Returns the provided vector clamped to desired magnitude.

Parameters
[in]vInput vector
[in]magnitudeThe magnitude to clamp at
Returns
clamped vector

◆ Extrapolate()

static void SCR_Math3D.Extrapolate ( IEntity entity,
Physics physics,
vector netPosition,
vector netVelocityLinear,
float netTeleportDistance,
float netRotation[4],
vector netVelocityAngular,
float netTeleportAng,
float timeSinceLastTick,
float timeSlice,
float netTickInterval )
static
Parameters
[in]entityis the entity you want to be affected by extrapolation.
[in]physicsis the physics that the extrapolation should calculate with.
[in]netPositionis the last received position.
[in]netVelocityLinearis the last received velocity.
[in]netTeleportDistanceis the max distance between position and netPosition, anything over this causes the entity to teleport.
[in]netRotationis the last received rotation.
[in]netVelocityAngularis the last received angular velocity.
[in]netTeleportAngis the max angle between current rotation and replicated rotation, anything over this causes the entity to teleport.
[in]timeSinceLastTickis the time since last synchronization of extrapolation relevant data was received, it should already be incremented by timeSlice by you!
[in]timeSliceis the time since last frame / simulation step.
[in]netTickIntervalmust NOT be zero

◆ FixEulerVector()

static vector SCR_Math3D.FixEulerVector ( vector angles,
float units = Math::PI )
static

Ensures the angles are in range <-units; +units>

Print(SCR_Math3D.FixEulerVector({270, 45, 900}, 180)); // {-90, 45, 180}
Contains various scripted 3D math functions.
Definition SCR_Math3D.c:3
static vector FixEulerVector(vector angles, float units=Math.PI)
Ensures the angles are in range <-units; +units>
Definition SCR_Math3D.c:56
Parameters
[in]angles
[in]units
Returns
angles in range <-units; +units>

◆ FixEulerVector180()

static vector SCR_Math3D.FixEulerVector180 ( vector angles)
static

Ensures the angles are in range <-180; +180>

Print(SCR_Math3D.FixEulerVector180({270, 45, 900})); // {-90, 45, 180}
static vector FixEulerVector180(vector angles)
Ensures the angles are in range <-180; +180>
Definition SCR_Math3D.c:73
Parameters
[in]angles
Returns
angles in range <-180; +180>

◆ GetDistanceFromSpline()

static float SCR_Math3D.GetDistanceFromSpline ( notnull array< vector > points,
vector point )
static

Gets the shortest 3D distance between a point and a spline.

Parameters
[in]pointsarray of all points forming the spline, minimum 1 point
[in]pointpoint that is being checked
Returns
distance from spline, -1 if no points are provided

◆ GetDistanceFromSplineXZ()

static float SCR_Math3D.GetDistanceFromSplineXZ ( notnull array< vector > points,
vector point )
static

Gets the shortest 2D distance between a point and a spline.

Parameters
[in]pointsarray of all points forming the spline, minimum 1 point
[in]pointpoint that is being checked
Returns
distance from spline, -1 if no points are provided

◆ GetFixedAxisVector()

static vector SCR_Math3D.GetFixedAxisVector ( vector toFlip)
static

Flips X and Y axis of the vector.

Parameters
[in]toFlip
Returns
the resulting vector

◆ IntersectPlane()

static vector SCR_Math3D.IntersectPlane ( vector rayPos,
vector rayVector,
vector planePos,
vector planeNormal )
static

Get intersection between a line and a plane.

Parameters
[in]rayPosRay intersection position
[in]rayVectorRay intersection direction vector
[in]planePosPlane position
[in]planeNormalPlane normal vector
Returns
Intersection position

◆ IsMatrixEmpty()

static bool SCR_Math3D.IsMatrixEmpty ( vector matrix[4])
static

Check if matrix is empty.

Parameters
[in]matrix
Returns
True when all matrix vectors are zero

◆ IsMatrixIdentity()

static bool SCR_Math3D.IsMatrixIdentity ( vector matrix[4])
static

Check if matrix is identity matrix (right, up, forward, zero vectors)

Parameters
[in]matrix
Returns
True when identity matrix

◆ IsPointWithinSplineDistance()

static bool SCR_Math3D.IsPointWithinSplineDistance ( notnull array< vector > points,
vector point,
float distance )
static

Check if point is within provided 3D distance from the shape - faster than getting distance then comparing.

Parameters
[in]pointsthe spline's points
[in]pointthe position to check
[in]distancethe checked distance (should be positive)
Returns
true if provided pos is <= distance from diff outline, false otherwise

◆ IsPointWithinSplineDistanceXZ()

static bool SCR_Math3D.IsPointWithinSplineDistanceXZ ( notnull array< vector > points,
vector point,
float distance )
static

Check if point is within provided 2D distance from the shape - faster than getting distance then comparing.

Parameters
[in]pointsthe spline's points
[in]pointthe position to check
[in]distancethe checked distance (should be positive)
Returns
true if provided pos is <= distance from diff outline, false otherwise

◆ LookAt()

static void SCR_Math3D.LookAt ( vector source,
vector destination,
vector up,
out vector rotMat[4] )
static

Returns a rotation matrix that makes object positioned at source position face the point at destination.

Parameters
[in]sourceSource point the rotation looks 'from'
[in]destinationTarget point the rotation looks 'at'
[in]upReference axis, start with 'vector.Up' if unsure
[out]rotMatOutput rotational matrix

◆ MatrixEqual()

static bool SCR_Math3D.MatrixEqual ( vector matrixA[4],
vector matrixB[4] )
static

Check if two matrices are equal.

Parameters
[in]matrixA
[in]matrixB
Returns
True when the matrices are equal

◆ Max()

static vector SCR_Math3D.Max ( vector vA,
vector vB )
static

Return the largest from each vector value.

Print(SCR_Math3D.Max({ 0, 2, 10 }, { -5, 5, 8 }, LogLevel.NORMAL); // { 0, 5, 10 }
static vector Max(vector vA, vector vB)
Return the largest from each vector value.
Definition SCR_Math3D.c:253
Parameters
[in]vectorA
[in]vectorB
Returns

◆ Min()

static vector SCR_Math3D.Min ( vector vA,
vector vB )
static

Return the smallest from each vector value.

Print(SCR_Math3D.Max({ 0, 2, 10 }, { -5, 5, 8 }, LogLevel.NORMAL); // { -5, 2, 8 }
Parameters
[in]vectorA
[in]vectorB
Returns

◆ MoveTowards()

static vector SCR_Math3D.MoveTowards ( vector start,
vector target,
float maxDistanceDelta )
static

Moves a point start in a straight line towards a target point.

Parameters
[in]start
[in]target
[in]maxDistanceDelta
Returns

◆ QuatAngleAxis()

static void SCR_Math3D.QuatAngleAxis ( float angle,
vector axis,
out float quat[4] )
static

Get a rotation that rotates angle (rad) around the provided axis.

float quat[4];
SCR_Math3D.QuatAngleAxis(0.5 * Math.PI_HALF, vector.Up, quat);
vector angles = Math3D.QuatToAngles( quat );
Print(angles);
>> vector angles = <45,0,-0>
static void QuatAngleAxis(float angle, vector axis, out float quat[4])
Get a rotation that rotates angle (rad) around the provided axis.
Definition SCR_Math3D.c:412
Parameters
[in]angleRotation angle in radians
[in]axisThe axis around which the rotation turns
[out]quatOutput quaternion

◆ QuatMultiply()

static vector SCR_Math3D.QuatMultiply ( float quat[4],
vector vec )
static

Rotates provided vector by given quaternion.

Parameters
[in]quatQuaternion rotation to apply
[in]vecVector to rotate
Returns
rotated vector

◆ RotateAround()

static void SCR_Math3D.RotateAround ( vector transform[4],
vector pivot,
vector axis,
float angle,
out vector result[4] )
static

Rotates a transformation around the provided pivot point by angle (rad) around the axis.

Parameters
[in]transformInput transformation to rotate
[in]pivotThe point around which the transform rotates
[in]axisThe axis in which the rotation is applied
[in]angleThe applied angle in radians
[out]resultRotated transformation

◆ RotateTowards()

static void SCR_Math3D.RotateTowards ( out float result[4],
float from[4],
float to[4],
float maxDegreesDelta )
static

Rotates the input from rotation to the input to rotation by a maximum of maxDegreesDelta.

Parameters
[out]result
[in]from
[in]to
[in]maxDegreesDelta

The documentation for this interface was generated from the following file: