Vector3

Classed used to store (x,y,z) vector representation A Vector3 is the main object used in 3D geometry It can represent etiher the coordinates of a point the space, either a direction Reminder: js uses a left handed forward facing system

• Vector3

Constructors

constructor

Find examples in Playground
• new Vector3(x?: number, y?: number, z?: number): Vector3
• Creates a new Vector3 object from the given x, y, z (floats) coordinates.

Parameters

• Optional x: number

defines the first coordinates (on X axis)

• Optional y: number

defines the second coordinates (on Y axis)

• Optional z: number

defines the third coordinates (on Z axis)

Properties

isNonUniform

Find examples in Playground
isNonUniform: boolean

Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same

x

Find examples in Playground
x: number

Defines the first coordinates (on X axis)

y

Find examples in Playground
y: number

Defines the second coordinates (on Y axis)

z

Find examples in Playground
z: number

Defines the third coordinates (on Z axis)

Find examples in Playground

Gets a up Vector3 that must not be updated

Find examples in Playground

Gets a zero Vector3 that must not be updated

Methods

Find examples in Playground
• Gets a new Vector3, result of the addition the current Vector3 and the given vector

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the resulting Vector3

Find examples in Playground
• Adds the given vector to the current Vector3

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the current updated Vector3

Find examples in Playground
• addInPlaceFromFloats(x: number, y: number, z: number): Vector3
• Adds the given coordinates to the current Vector3

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the current updated Vector3

Find examples in Playground
• Adds the current Vector3 to the given one and stores the result in the vector "result"

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the current Vector3

asArray

Find examples in Playground
• asArray(): number[]
• Creates an array containing three elements : the coordinates of the Vector3

Returns number[]

a new array of numbers

clone

Find examples in Playground
• Creates a new Vector3 copied from the current Vector3

Returns Vector3

the new Vector3

copyFrom

Find examples in Playground
• Copies the given vector coordinates to the current Vector3 ones

Parameters

• source: DeepImmutable<Vector3>

defines the source Vector3

Returns Vector3

the current updated Vector3

copyFromFloats

Find examples in Playground
• copyFromFloats(x: number, y: number, z: number): Vector3
• Copies the given floats to the current Vector3 coordinates

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the current updated Vector3

divide

Find examples in Playground
• Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the new Vector3

divideInPlace

Find examples in Playground
• Divides the current Vector3 coordinates by the given ones.

Parameters

• otherVector: Vector3

defines the second operand

Returns Vector3

the current updated Vector3

divideToRef

Find examples in Playground
• Divides the current Vector3 coordinates by the given ones and stores the result in the given vector "result"

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the current Vector3

equals

Find examples in Playground
• Returns true if the current Vector3 and the given vector coordinates are strictly equal

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns boolean

true if both vectors are equals

equalsToFloats

Find examples in Playground
• equalsToFloats(x: number, y: number, z: number): boolean
• Returns true if the current Vector3 coordinates equals the given floats

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns boolean

true if both vectors are equals

equalsWithEpsilon

Find examples in Playground
• Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

• Optional epsilon: number

defines the minimal distance to define values as equals

Returns boolean

true if both vectors are distant less than epsilon

floor

Find examples in Playground
• Gets a new Vector3 from current Vector3 floored values

Returns Vector3

a new Vector3

fract

Find examples in Playground
• Gets a new Vector3 from current Vector3 floored values

Returns Vector3

a new Vector3

getClassName

Find examples in Playground
• getClassName(): string
• Gets the class name

Returns string

the string "Vector3"

getHashCode

Find examples in Playground
• getHashCode(): number
• Creates the Vector3 hash code

Returns number

a number which tends to be unique between Vector3 instances

isNonUniformWithinEpsilon

Find examples in Playground
• isNonUniformWithinEpsilon(epsilon: number): boolean
• Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction Check if is non uniform within a certain amount of decimal places to account for this

Parameters

• epsilon: number

the amount the values can differ

Returns boolean

if the the vector is non uniform to a certain number of decimal places

length

Find examples in Playground
• length(): number
• Gets the length of the Vector3

Returns number

the length of the Vector3

lengthSquared

Find examples in Playground
• lengthSquared(): number
• Gets the squared length of the Vector3

Returns number

squared length of the Vector3

maximizeInPlace

Find examples in Playground
• Updates the current Vector3 with the maximal coordinate values between its and the given vector ones.

Parameters

• other: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the current updated Vector3

maximizeInPlaceFromFloats

Find examples in Playground
• maximizeInPlaceFromFloats(x: number, y: number, z: number): Vector3
• Updates the current Vector3 with the maximal coordinate values between its and the given coordinates.

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the current updated Vector3

minimizeInPlace

Find examples in Playground
• Updates the current Vector3 with the minimal coordinate values between its and the given vector ones

Parameters

• other: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the current updated Vector3

minimizeInPlaceFromFloats

Find examples in Playground
• minimizeInPlaceFromFloats(x: number, y: number, z: number): Vector3
• Updates the current Vector3 with the minimal coordinate values between its and the given coordinates

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the current updated Vector3

multiply

Find examples in Playground
• Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the new Vector3

multiplyByFloats

Find examples in Playground
• multiplyByFloats(x: number, y: number, z: number): Vector3
• Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the new Vector3

multiplyInPlace

Find examples in Playground
• Multiplies the current Vector3 coordinates by the given ones

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the current updated Vector3

multiplyToRef

Find examples in Playground
• Multiplies the current Vector3 by the given one and stores the result in the given vector "result"

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the current Vector3

negate

Find examples in Playground
• Gets a new Vector3 set with the current Vector3 negated coordinates

Returns Vector3

a new Vector3

normalize

Find examples in Playground
• Normalize the current Vector3. Please note that this is an in place operation.

Returns Vector3

the current updated Vector3

normalizeFromLength

Find examples in Playground
• normalizeFromLength(len: number): Vector3
• Normalize the current Vector3 with the given input length. Please note that this is an in place operation.

Parameters

• len: number

the length of the vector

Returns Vector3

the current updated Vector3

normalizeToNew

Find examples in Playground
• Normalize the current Vector3 to a new vector

Returns Vector3

the new Vector3

normalizeToRef

Find examples in Playground
• Normalize the current Vector3 to the reference

Parameters

• reference: DeepImmutable<Vector3>

define the Vector3 to update

Returns Vector3

the updated Vector3

reorderInPlace

Find examples in Playground
• reorderInPlace(order: string): this
• Reorders the x y z properties of the vector in place

Parameters

• order: string

new ordering of the properties (eg. for vector 1,2,3 with "ZYX" will produce 3,2,1)

Returns this

the current updated vector

rotateByQuaternionAroundPointToRef

Find examples in Playground
• Rotates a vector around a given point

Parameters

• quaternion: Quaternion

the rotation quaternion

• point: Vector3

the point to rotate around

• result: Vector3

vector to store the result

Returns Vector3

the resulting vector

rotateByQuaternionToRef

Find examples in Playground
• Rotates the vector around 0,0,0 by a quaternion

Parameters

• quaternion: Quaternion

the rotation quaternion

• result: Vector3

vector to store the result

Returns Vector3

the resulting vector

scale

Find examples in Playground
• Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale"

Parameters

• scale: number

defines the multiplier factor

Returns Vector3

a new Vector3

Find examples in Playground
• Scale the current Vector3 values by a factor and add the result to a given Vector3

Parameters

• scale: number

defines the scale factor

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the unmodified current Vector3

scaleInPlace

Find examples in Playground
• scaleInPlace(scale: number): Vector3
• Multiplies the Vector3 coordinates by the float "scale"

Parameters

• scale: number

defines the multiplier factor

Returns Vector3

the current updated Vector3

scaleToRef

Find examples in Playground
• Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the given vector "result" coordinates

Parameters

• scale: number

defines the multiplier factor

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the current Vector3

set

Find examples in Playground
• set(x: number, y: number, z: number): Vector3
• Copies the given floats to the current Vector3 coordinates

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the current updated Vector3

setAll

Find examples in Playground
• Copies the given float to the current Vector3 coordinates

Parameters

• v: number

defines the x, y and z coordinates of the operand

Returns Vector3

the current updated Vector3

subtract

Find examples in Playground
• Returns a new Vector3, result of the subtraction of the given vector from the current Vector3

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the resulting Vector3

subtractFromFloats

Find examples in Playground
• subtractFromFloats(x: number, y: number, z: number): Vector3
• Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

Returns Vector3

the resulting Vector3

subtractFromFloatsToRef

Find examples in Playground
• subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3
• Subtracts the given floats from the current Vector3 coordinates and set the given vector "result" with this result

Parameters

• x: number

defines the x coordinate of the operand

• y: number

defines the y coordinate of the operand

• z: number

defines the z coordinate of the operand

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the current Vector3

subtractInPlace

Find examples in Playground
• Subtract the given vector from the current Vector3

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the current updated Vector3

subtractToRef

Find examples in Playground
• Subtracts the given vector from the current Vector3 and stores the result in the vector "result".

Parameters

• otherVector: DeepImmutable<Vector3>

defines the second operand

• result: Vector3

defines the Vector3 object where to store the result

Returns Vector3

the current Vector3

toArray

Find examples in Playground
• Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3

Parameters

• array: FloatArray

defines the destination array

• Optional index: number

defines the offset in the destination array

Returns Vector3

the current Vector3

toQuaternion

Find examples in Playground
• Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation)

Returns Quaternion

a new Quaternion object, computed from the Vector3 coordinates

toString

Find examples in Playground
• toString(): string
• Creates a string representation of the Vector3

Returns string

a string with the Vector3 coordinates.

Static Backward

Find examples in Playground
• Returns a new Vector3 set to (0.0, 0.0, -1.0)

Returns Vector3

a new forward Vector3

Static CatmullRom

Find examples in Playground
• Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4"

Parameters

• value1: DeepImmutable<Vector3>

defines the first control point

• value2: DeepImmutable<Vector3>

defines the second control point

• value3: DeepImmutable<Vector3>

defines the third control point

• value4: DeepImmutable<Vector3>

defines the fourth control point

• amount: number

defines the amount on the spline to use

Returns Vector3

the new Vector3

Static Center

Find examples in Playground
• Returns a new Vector3 located at the center between "value1" and "value2"

Parameters

• value1: DeepImmutable<Vector3>

defines the first operand

• value2: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the new Vector3

Static Clamp

Find examples in Playground
• Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max" If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one

Parameters

• value: DeepImmutable<Vector3>

defines the current value

• min: DeepImmutable<Vector3>

defines the lower range value

• max: DeepImmutable<Vector3>

defines the upper range value

Returns Vector3

the new Vector3

Static ClampToRef

Find examples in Playground
• Sets the given vector "result" with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max" If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one

Parameters

• value: DeepImmutable<Vector3>

defines the current value

• min: DeepImmutable<Vector3>

defines the lower range value

• max: DeepImmutable<Vector3>

defines the upper range value

• result: Vector3

defines the Vector3 where to store the result

Static Cross

Find examples in Playground
• Returns a new Vector3 as the cross product of the vectors "left" and "right" The cross product is then orthogonal to both "left" and "right"

Parameters

• left: DeepImmutable<Vector3>

defines the left operand

• right: DeepImmutable<Vector3>

defines the right operand

Returns Vector3

the cross product

Static CrossToRef

Find examples in Playground
• Sets the given vector "result" with the cross product of "left" and "right" The cross product is then orthogonal to both "left" and "right"

Parameters

• left: Vector3

defines the left operand

• right: Vector3

defines the right operand

• result: Vector3

defines the Vector3 where to store the result

Static Distance

Find examples in Playground
• Returns the distance between the vectors "value1" and "value2"

Parameters

• value1: DeepImmutable<Vector3>

defines the first operand

• value2: DeepImmutable<Vector3>

defines the second operand

the distance

Static DistanceSquared

Find examples in Playground
• Returns the squared distance between the vectors "value1" and "value2"

Parameters

• value1: DeepImmutable<Vector3>

defines the first operand

• value2: DeepImmutable<Vector3>

defines the second operand

Returns number

the squared distance

Static Dot

Find examples in Playground
• Returns the dot product (float) between the vectors "left" and "right"

Parameters

• left: DeepImmutable<Vector3>

defines the left operand

• right: DeepImmutable<Vector3>

defines the right operand

Returns number

the dot product

Static Down

Find examples in Playground
• Returns a new Vector3 set to (0.0, -1.0, 0.0)

Returns Vector3

a new down Vector3

Static Forward

Find examples in Playground
• Returns a new Vector3 set to (0.0, 0.0, 1.0)

Returns Vector3

a new forward Vector3

Static FromArray

Find examples in Playground
• Returns a new Vector3 set from the index "offset" of the given array

Parameters

• array: DeepImmutable<ArrayLike<number>>

defines the source array

• Optional offset: number

defines the offset in the source array

Returns Vector3

the new Vector3

Static FromArrayToRef

Find examples in Playground
• Sets the given vector "result" with the element values from the index "offset" of the given array

Parameters

• array: DeepImmutable<ArrayLike<number>>

defines the source array

• offset: number

defines the offset in the source array

• result: Vector3

defines the Vector3 where to store the result

Static FromFloatArray

Find examples in Playground
• Returns a new Vector3 set from the index "offset" of the given Float32Array This function is deprecated. Use FromArray instead

Parameters

• array: DeepImmutable<Float32Array>

defines the source array

• Optional offset: number

defines the offset in the source array

Returns Vector3

the new Vector3

Static FromFloatArrayToRef

Find examples in Playground
• Sets the given vector "result" with the element values from the index "offset" of the given Float32Array This function is deprecated. Use FromArrayToRef instead.

Parameters

• array: DeepImmutable<Float32Array>

defines the source array

• offset: number

defines the offset in the source array

• result: Vector3

defines the Vector3 where to store the result

Static FromFloatsToRef

Find examples in Playground
• FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void
• Sets the given vector "result" with the given floats.

Parameters

• x: number

defines the x coordinate of the source

• y: number

defines the y coordinate of the source

• z: number

defines the z coordinate of the source

• result: Vector3

defines the Vector3 where to store the result

Static GetAngleBetweenVectors

Find examples in Playground
• Get angle between two vectors

Parameters

• vector0: DeepImmutable<Vector3>

angle between vector0 and vector1

• vector1: DeepImmutable<Vector3>

angle between vector0 and vector1

• normal: DeepImmutable<Vector3>

direction of the normal

Returns number

the angle between vector0 and vector1

Static GetClipFactor

Find examples in Playground
• Get the clip factor between two vectors

Parameters

• vector0: DeepImmutable<Vector3>

defines the first operand

• vector1: DeepImmutable<Vector3>

defines the second operand

• axis: DeepImmutable<Vector3>

defines the axis to use

• size: number

defines the size along the axis

Returns number

the clip factor

Static Hermite

Find examples in Playground
• Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2"

Parameters

• value1: DeepImmutable<Vector3>

defines the first control point

• tangent1: DeepImmutable<Vector3>

defines the first tangent vector

• value2: DeepImmutable<Vector3>

defines the second control point

• tangent2: DeepImmutable<Vector3>

defines the second tangent vector

• amount: number

defines the amount on the interpolation spline (between 0 and 1)

Returns Vector3

the new Vector3

Static Left

Find examples in Playground
• Returns a new Vector3 set to (-1.0, 0.0, 0.0)

Returns Vector3

a new left Vector3

Static Lerp

Find examples in Playground
• Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end"

Parameters

• start: DeepImmutable<Vector3>

defines the start value

• end: DeepImmutable<Vector3>

defines the end value

• amount: number

max defines amount between both (between 0 and 1)

Returns Vector3

the new Vector3

Static LerpToRef

Find examples in Playground
• Sets the given vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end"

Parameters

• start: DeepImmutable<Vector3>

defines the start value

• end: DeepImmutable<Vector3>

defines the end value

• amount: number

max defines amount between both (between 0 and 1)

• result: Vector3

defines the Vector3 where to store the result

Static Maximize

Find examples in Playground
• Gets the maximal coordinate values between two Vector3

Parameters

• left: DeepImmutable<Vector3>

defines the first operand

• right: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the new Vector3

Static Minimize

Find examples in Playground
• Gets the minimal coordinate values between two Vector3

Parameters

• left: DeepImmutable<Vector3>

defines the first operand

• right: DeepImmutable<Vector3>

defines the second operand

Returns Vector3

the new Vector3

Static Normalize

Find examples in Playground
• Returns a new Vector3 as the normalization of the given vector

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to normalize

Returns Vector3

the new Vector3

Static NormalizeToRef

Find examples in Playground
• Sets the given vector "result" with the normalization of the given first vector

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to normalize

• result: Vector3

defines the Vector3 where to store the result

Static One

Find examples in Playground
• Returns a new Vector3 set to (1.0, 1.0, 1.0)

Returns Vector3

a new unit Vector3

Static Project

Find examples in Playground
• Project a Vector3 onto screen space

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to project

• world: DeepImmutable<Matrix>

defines the world matrix to use

• transform: DeepImmutable<Matrix>

defines the transform (view x projection) matrix to use

• viewport: DeepImmutable<Viewport>

defines the screen viewport to use

Returns Vector3

the new Vector3

Static Right

Find examples in Playground
• Returns a new Vector3 set to (1.0, 0.0, 0.0)

Returns Vector3

a new right Vector3

Static RotationFromAxis

Find examples in Playground
• Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system), RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply to something in order to rotate it from its local system to the given target system Note: axis1, axis2 and axis3 are normalized during this operation

Parameters

• axis1: DeepImmutable<Vector3>

defines the first axis

• axis2: DeepImmutable<Vector3>

defines the second axis

• axis3: DeepImmutable<Vector3>

defines the third axis

Returns Vector3

a new Vector3

Static RotationFromAxisToRef

Find examples in Playground
• The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3

Parameters

• axis1: DeepImmutable<Vector3>

defines the first axis

• axis2: DeepImmutable<Vector3>

defines the second axis

• axis3: DeepImmutable<Vector3>

defines the third axis

• ref: Vector3

defines the Vector3 where to store the result

Static TransformCoordinates

Find examples in Playground
• Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector. This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to transform

• transformation: DeepImmutable<Matrix>

defines the transformation matrix

Returns Vector3

the transformed Vector3

Static TransformCoordinatesFromFloatsToRef

Find examples in Playground
• TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: DeepImmutable<Matrix>, result: Vector3): void
• Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z) This method computes tranformed coordinates only, not transformed direction vectors

Parameters

• x: number

define the x coordinate of the source vector

• y: number

define the y coordinate of the source vector

• z: number

define the z coordinate of the source vector

• transformation: DeepImmutable<Matrix>

defines the transformation matrix

• result: Vector3

defines the Vector3 where to store the result

Static TransformCoordinatesToRef

Find examples in Playground
• Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given vector This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to transform

• transformation: DeepImmutable<Matrix>

defines the transformation matrix

• result: Vector3

defines the Vector3 where to store the result

Static TransformNormal

Find examples in Playground
• Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector This methods computes transformed normalized direction vectors only (ie. it does not apply translation)

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to transform

• transformation: DeepImmutable<Matrix>

defines the transformation matrix

Returns Vector3

the new Vector3

Static TransformNormalFromFloatsToRef

Find examples in Playground
• Sets the given vector "result" with the result of the normal transformation by the given matrix of the given floats (x, y, z) This methods computes transformed normalized direction vectors only (ie. it does not apply translation)

Parameters

• x: number

define the x coordinate of the source vector

• y: number

define the y coordinate of the source vector

• z: number

define the z coordinate of the source vector

• transformation: DeepImmutable<Matrix>

defines the transformation matrix

• result: Vector3

defines the Vector3 where to store the result

Static TransformNormalToRef

Find examples in Playground
• Sets the given vector "result" with the result of the normal transformation by the given matrix of the given vector This methods computes transformed normalized direction vectors only (ie. it does not apply translation)

Parameters

• vector: DeepImmutable<Vector3>

defines the Vector3 to transform

• transformation: DeepImmutable<Matrix>

defines the transformation matrix

• result: Vector3

defines the Vector3 where to store the result

Static Unproject

Find examples in Playground
• Unproject from screen space to object space

Parameters

• source: DeepImmutable<Vector3>

defines the screen space Vector3 to use

• viewportWidth: number

defines the current width of the viewport

• viewportHeight: number

defines the current height of the viewport

• world: DeepImmutable<Matrix>

defines the world matrix to use (can be set to Identity to go to world space)

• view: DeepImmutable<Matrix>

defines the view matrix to use

• projection: DeepImmutable<Matrix>

defines the projection matrix to use

Returns Vector3

the new Vector3

Static UnprojectFloatsToRef

Find examples in Playground
• Unproject from screen space to object space

Parameters

• sourceX: float

defines the screen space x coordinate to use

• sourceY: float

defines the screen space y coordinate to use

• sourceZ: float

defines the screen space z coordinate to use

• viewportWidth: number

defines the current width of the viewport

• viewportHeight: number

defines the current height of the viewport

• world: DeepImmutable<Matrix>

defines the world matrix to use (can be set to Identity to go to world space)

• view: DeepImmutable<Matrix>

defines the view matrix to use

• projection: DeepImmutable<Matrix>

defines the projection matrix to use

• result: Vector3

defines the Vector3 where to store the result

Static UnprojectFromTransform

Find examples in Playground
• Unproject from screen space to object space

Parameters

• source: Vector3

defines the screen space Vector3 to use

• viewportWidth: number

defines the current width of the viewport

• viewportHeight: number

defines the current height of the viewport

• world: DeepImmutable<Matrix>

defines the world matrix to use (can be set to Identity to go to world space)

• transform: DeepImmutable<Matrix>

defines the transform (view x projection) matrix to use

Returns Vector3

the new Vector3

Static UnprojectToRef

Find examples in Playground
• Unproject from screen space to object space

Parameters

• source: DeepImmutable<Vector3>

defines the screen space Vector3 to use

• viewportWidth: number

defines the current width of the viewport

• viewportHeight: number

defines the current height of the viewport

• world: DeepImmutable<Matrix>

defines the world matrix to use (can be set to Identity to go to world space)

• view: DeepImmutable<Matrix>

defines the view matrix to use

• projection: DeepImmutable<Matrix>

defines the projection matrix to use

• result: Vector3

defines the Vector3 where to store the result

Static Up

Find examples in Playground
• Returns a new Vector3 set to (0.0, 1.0, 0.0)

Returns Vector3

a new up Vector3

Static Zero

Find examples in Playground
• Returns a new Vector3 set to (0.0, 0.0, 0.0)

Returns Vector3

a new empty Vector3

Generated using TypeDoc