Class Vector3
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a new Vector3 object from the given x, y, z (floats) coordinates.
Parameters
- x: number = 0
defines the first coordinates (on X axis)
- y: number = 0
defines the second coordinates (on Y axis)
- z: number = 0
defines the third coordinates (on Z axis)
Returns Vector3
- x: number = 0
Properties
Readonlydimension
Readonlyrank
Static_ V8 Performance Hack
If the first vector is flagged with integers (as everything is 0,0,0), V8 stores all of the properties as integers internally because it doesn't know any better yet. If subsequent vectors are created with non-integer values, V8 determines that it would be best to represent these properties as doubles instead of integers, and henceforth it will use floating-point representation for all Vector3 instances that it creates. But the original Vector3 instances are unchanged and has a "deprecated map". If we keep using the Vector3 instances from step 1, it will now be a poison pill which will mess up optimizations in any code it touches.
Accessors
has A Zero Component
-
get hasAZeroComponent(): boolean
Gets a boolean indicating if the vector contains a zero in one of its components Example Playground https://playground.babylonjs.com/#R1F8YU#1
Returns boolean
is Non Uniform
-
get isNonUniform(): boolean
Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same
Returns boolean
x
-
get x(): number
Gets or sets the x coordinate
Returns number
-
set x(value: number): void
Parameters
- value: number
Returns void
y
-
get y(): number
Gets or sets the y coordinate
Returns number
-
set y(value: number): void
Parameters
- value: number
Returns void
z
-
get z(): number
Gets or sets the z coordinate
Returns number
-
set z(value: number): void
Parameters
- value: number
Returns void
StaticDown Read Only
-
Gets a down Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticLeft Handed Backward Read Only
-
Gets a backward Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticLeft Handed Forward Read Only
-
Gets a forward Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticLeft Read Only
-
Gets a left Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticOne Read Only
-
Gets a one Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticRight Handed Backward Read Only
-
Gets a backward Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticRight Handed Forward Read Only
-
Gets a forward Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticRight Read Only
-
Gets a right Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticUp Read Only
-
Gets an up Vector3 that must not be updated
Returns DeepImmutable<Vector3>
StaticZero Read Only
-
Gets a zero Vector3 that must not be updated
Returns DeepImmutable<Vector3>
Methods
add
-
Gets a new Vector3, result of the addition the current Vector3 and the given vector Example Playground https://playground.babylonjs.com/#R1F8YU#3
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns Vector3
the resulting Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
add In Place
-
Adds the given vector to the current Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#4
Parameters
- otherVector: DeepImmutable<Vector3>
defines the second operand
Returns this
the current updated Vector3
- otherVector: DeepImmutable<Vector3>
add In Place From Floats
-
Adds the given coordinates to the current Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#5
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 this
the current updated Vector3
- x: number
add To Ref
-
addToRef<T extends IVector3LikeInternal>(
otherVector: DeepImmutable<IVector3LikeInternal>,
result: T,
): TAdds the current Vector3 to the given one and stores the result in the vector "result" Example Playground https://playground.babylonjs.com/#R1F8YU#6
Type Parameters
- T extends IVector3LikeInternal
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
- result: T
defines the Vector3 object where to store the result
Returns T
the result
apply Rotation Quaternion
-
Rotates the vector using the given unit quaternion and returns the new vector Example Playground https://playground.babylonjs.com/#R1F8YU#7
Parameters
- q: Quaternion
the unit quaternion representing the rotation
Returns Vector3
a new Vector3
- q: Quaternion
apply Rotation Quaternion In Place
-
Rotates the vector in place using the given unit quaternion Example Playground https://playground.babylonjs.com/#R1F8YU#8
Parameters
- q: Quaternion
the unit quaternion representing the rotation
Returns this
the current updated Vector3
- q: Quaternion
apply Rotation Quaternion To Ref
-
Rotates the vector using the given unit quaternion and stores the new vector in result Example Playground https://playground.babylonjs.com/#R1F8YU#9
Type Parameters
- T extends Vector3
Parameters
- q: Quaternion
the unit quaternion representing the rotation
- result: T
the output vector
Returns T
the result
as Array
-
Creates an array containing three elements : the coordinates of the Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#10
Returns [number, number, number]
a new array of numbers
clone
-
Creates a new Vector3 copied from the current Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#11
Returns Vector3
the new Vector3
copy From
-
Copies the given vector coordinates to the current Vector3 ones Example Playground https://playground.babylonjs.com/#R1F8YU#12
Parameters
- source: DeepImmutable<Vector3>
defines the source Vector3
Returns this
the current updated Vector3
- source: DeepImmutable<Vector3>
copy From Floats
-
Copies the given floats to the current Vector3 coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#13
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 this
the current updated Vector3
- x: number
cross
-
Returns a new Vector3 as the cross product of the current vector and the "other" one The cross product is then orthogonal to both current and "other" Example Playground https://playground.babylonjs.com/#R1F8YU#14
Parameters
- other: Vector3
defines the right operand
Returns Vector3
the cross product
- other: Vector3
divide
-
Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones Example Playground https://playground.babylonjs.com/#R1F8YU#16
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns Vector3
the new Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
divide In Place
-
Divides the current Vector3 coordinates by the given ones. Example Playground https://playground.babylonjs.com/#R1F8YU#17
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns this
the current updated Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
divide To Ref
-
divideToRef<T extends IVector3LikeInternal>(
otherVector: DeepImmutable<IVector3LikeInternal>,
result: T,
): TDivides the current Vector3 coordinates by the given ones and stores the result in the given vector "result" Example Playground https://playground.babylonjs.com/#R1F8YU#18
Type Parameters
- T extends IVector3LikeInternal
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
- result: T
defines the Vector3 object where to store the result
Returns T
the result
dot
-
Returns the dot product (float) between the current vectors and "otherVector"
Parameters
- otherVector: DeepImmutable<Vector3>
defines the right operand
Returns number
the dot product
- otherVector: DeepImmutable<Vector3>
equals
-
Returns true if the current Vector3 and the given vector coordinates are strictly equal Example Playground https://playground.babylonjs.com/#R1F8YU#19
Parameters
- otherVector: DeepImmutable<Vector3>
defines the second operand
Returns boolean
true if both vectors are equals
- otherVector: DeepImmutable<Vector3>
equals To Floats
-
Returns true if the current Vector3 coordinates equals the given floats Example Playground https://playground.babylonjs.com/#R1F8YU#20
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 equal
- x: number
equals With Epsilon
-
Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon Example Playground https://playground.babylonjs.com/#R1F8YU#21
Parameters
- otherVector: DeepImmutable<Vector3>
defines the second operand
- epsilon: number = Epsilon
defines the minimal distance to define values as equals
Returns boolean
true if both vectors are distant less than epsilon
- otherVector: DeepImmutable<Vector3>
floor
-
Gets a new Vector3 from current Vector3 floored values Example Playground https://playground.babylonjs.com/#R1F8YU#22
Returns Vector3
a new Vector3
floor To Ref
fract
-
Gets a new Vector3 from current Vector3 fractional values Example Playground https://playground.babylonjs.com/#R1F8YU#23
Returns Vector3
a new Vector3
fract To Ref
from Array
-
Update the current vector from an array Example Playground https://playground.babylonjs.com/#R1F8YU#24
Parameters
- array: DeepImmutable<FloatArray>
defines the destination array
- offset: number = 0
defines the offset in the destination array
Returns this
the current Vector3
- array: DeepImmutable<FloatArray>
get Class Name
-
Gets the class name
Returns string
the string "Vector3"
get Hash Code
-
Creates the Vector3 hash code
Returns number
a number which tends to be unique between Vector3 instances
get Normal To Ref
-
Creates a vector normal (perpendicular) to the current Vector3 and stores the result in the given vector Out of the infinite possibilities the normal chosen is the one formed by rotating the current vector 90 degrees about an axis which lies perpendicular to the current vector and its projection on the xz plane. In the case of a current vector in the xz plane the normal is calculated to be along the y axis. Example Playground https://playground.babylonjs.com/#R1F8YU#230 Example Playground https://playground.babylonjs.com/#R1F8YU#231
Parameters
- result: Vector3
defines the Vector3 object where to store the resultant normal
Returns Vector3
the result
- result: Vector3
is Non Uniform Within Epsilon
-
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 vector is non uniform to a certain number of decimal places
- epsilon: number
length
-
Gets the length of the Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#25
Returns number
the length of the Vector3
length Squared
-
Gets the squared length of the Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#26
Returns number
squared length of the Vector3
maximize In Place
-
Updates the current Vector3 with the maximal coordinate values between its and the given vector ones. Example Playground https://playground.babylonjs.com/#R1F8YU#27
Parameters
- other: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns this
the current updated Vector3
- other: DeepImmutable<IVector3LikeInternal>
maximize In Place From Floats
-
Updates the current Vector3 with the maximal coordinate values between its and the given coordinates. Example Playground https://playground.babylonjs.com/#R1F8YU#28
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 this
the current updated Vector3
- x: number
minimize In Place
-
Updates the current Vector3 with the minimal coordinate values between its and the given vector ones Example Playground https://playground.babylonjs.com/#R1F8YU#29
Parameters
- other: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns this
the current updated Vector3
- other: DeepImmutable<IVector3LikeInternal>
minimize In Place From Floats
-
Updates the current Vector3 with the minimal coordinate values between its and the given coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#30
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 this
the current updated Vector3
- x: number
multiply
-
Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector Example Playground https://playground.babylonjs.com/#R1F8YU#31
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns Vector3
the new Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
multiply By Floats
-
Returns a new Vector3 set with the result of the multiplication of the current Vector3 coordinates by the given floats Example Playground https://playground.babylonjs.com/#R1F8YU#34
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
- x: number
multiply In Place
-
Multiplies the current Vector3 coordinates by the given ones Example Playground https://playground.babylonjs.com/#R1F8YU#32
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns this
the current updated Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
multiply To Ref
-
multiplyToRef<T extends IVector3LikeInternal>(
otherVector: DeepImmutable<IVector3LikeInternal>,
result: T,
): TMultiplies the current Vector3 by the given one and stores the result in the given vector "result" Example Playground https://playground.babylonjs.com/#R1F8YU#33
Type Parameters
- T extends IVector3LikeInternal
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
- result: T
defines the Vector3 object where to store the result
Returns T
the result
negate
-
Gets a new Vector3 set with the current Vector3 negated coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#35
Returns Vector3
a new Vector3
negate In Place
-
Negate this vector in place Example Playground https://playground.babylonjs.com/#R1F8YU#36
Returns this
this
negate To Ref
-
Negate the current Vector3 and stores the result in the given vector "result" coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#37
Type Parameters
- T extends IVector3LikeInternal
Parameters
- result: T
defines the Vector3 object where to store the result
Returns T
the result
normalize
-
Normalize the current Vector3. Please note that this is an in place operation. Example Playground https://playground.babylonjs.com/#R1F8YU#122
Returns this
the current updated Vector3
normalize From Length
-
Normalize the current Vector3 with the given input length. Please note that this is an in place operation. Example Playground https://playground.babylonjs.com/#R1F8YU#123
Parameters
- len: number
the length of the vector
Returns this
the current updated Vector3
- len: number
normalize To New
-
Normalize the current Vector3 to a new vector Example Playground https://playground.babylonjs.com/#R1F8YU#124
Returns Vector3
the new Vector3
normalize To Ref
-
Normalize the current Vector3 to the reference Example Playground https://playground.babylonjs.com/#R1F8YU#125
Type Parameters
- T extends IVector3LikeInternal
Parameters
- result: T
define the Vector3 to update
Returns T
the updated Vector3
project On Plane
-
Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3. Example Playground https://playground.babylonjs.com/#R1F8YU#48
Parameters
Returns Vector3
the projected vector3
project On Plane To Ref
-
Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3. Example Playground https://playground.babylonjs.com/#R1F8YU#49
Type Parameters
- T extends Vector3
Parameters
Returns T
result input
reorder In Place
-
Reorders the x y z properties of the vector in place Example Playground https://playground.babylonjs.com/#R1F8YU#44
Parameters
- order: string
new ordering of the properties (eg. for vector 1,2,3 with "ZYX" will produce 3,2,1)
Returns Vector3
the current updated vector
- order: string
rotate By Quaternion Around Point To Ref
-
rotateByQuaternionAroundPointToRef<T extends Vector3>(
quaternion: Quaternion,
point: Vector3,
result: T,
): TRotates a vector around a given point Example Playground https://playground.babylonjs.com/#R1F8YU#46
Type Parameters
- T extends Vector3
Parameters
- quaternion: Quaternion
the rotation quaternion
- point: Vector3
the point to rotate around
- result: T
vector to store the result
Returns T
the resulting vector
rotate By Quaternion To Ref
-
Rotates the vector around 0,0,0 by a quaternion Example Playground https://playground.babylonjs.com/#R1F8YU#47
Type Parameters
- T extends Vector3
Parameters
- quaternion: Quaternion
the rotation quaternion
- result: T
vector to store the result
Returns T
the resulting vector
scale
-
Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale" Example Playground https://playground.babylonjs.com/#R1F8YU#53
Parameters
- scale: number
defines the multiplier factor
Returns Vector3
a new Vector3
- scale: number
scale And Add To Ref
-
Scale the current Vector3 values by a factor and add the result to a given Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#55
Type Parameters
- T extends IVector3LikeInternal
Parameters
- scale: number
defines the scale factor
- result: T
defines the Vector3 object where to store the result
Returns T
result input
scale In Place
-
Multiplies the Vector3 coordinates by the float "scale" Example Playground https://playground.babylonjs.com/#R1F8YU#56
Parameters
- scale: number
defines the multiplier factor
Returns this
the current updated Vector3
- scale: number
scale To Ref
-
Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the given vector "result" coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#57
Type Parameters
- T extends IVector3LikeInternal
Parameters
- scale: number
defines the multiplier factor
- result: T
defines the Vector3 object where to store the result
Returns T
the result
set
-
Copies the given floats to the current Vector3 coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#58
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 this
the current updated Vector3
- x: number
set All
-
Copies the given float to the current Vector3 coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#59
Parameters
- v: number
defines the x, y and z coordinates of the operand
Returns this
the current updated Vector3
- v: number
subtract
-
Returns a new Vector3, result of the subtraction of the given vector from the current Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#60
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns Vector3
the resulting Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
subtract From Floats
-
Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates Example Playground https://playground.babylonjs.com/#R1F8YU#62
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
- x: number
subtract From Floats To Ref
-
subtractFromFloatsToRef<T extends IVector3LikeInternal>(
x: number,
y: number,
z: number,
result: T,
): TSubtracts the given floats from the current Vector3 coordinates and set the given vector "result" with this result Example Playground https://playground.babylonjs.com/#R1F8YU#64
Type Parameters
- T extends IVector3LikeInternal
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: T
defines the Vector3 object where to store the result
Returns T
the result
subtract In Place
-
Subtract the given vector from the current Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#61
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
Returns this
the current updated Vector3
- otherVector: DeepImmutable<IVector3LikeInternal>
subtract To Ref
-
subtractToRef<T extends IVector3LikeInternal>(
otherVector: DeepImmutable<IVector3LikeInternal>,
result: T,
): TSubtracts the given vector from the current Vector3 and stores the result in the vector "result". Example Playground https://playground.babylonjs.com/#R1F8YU#63
Type Parameters
- T extends IVector3LikeInternal
Parameters
- otherVector: DeepImmutable<IVector3LikeInternal>
defines the second operand
- result: T
defines the Vector3 object where to store the result
Returns T
the result
to Array
-
Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#65
Parameters
- array: FloatArray
defines the destination array
- index: number = 0
defines the offset in the destination array
Returns this
the current Vector3
- array: FloatArray
to Quaternion
-
Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation) Example Playground https://playground.babylonjs.com/#R1F8YU#66
Returns Quaternion
a new Quaternion object, computed from the Vector3 coordinates
to String
-
Creates a string representation of the Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#67
Returns string
a string with the Vector3 coordinates.
StaticBackward
-
Returns a new Vector3 set to (0.0, 0.0, -1.0) Example Playground https://playground.babylonjs.com/#R1F8YU#71
Parameters
- rightHandedSystem: boolean = false
is the scene right-handed (negative-z)
Returns Vector3
a new Backward Vector3
- rightHandedSystem: boolean = false
StaticCatmull Rom
-
CatmullRom(
value1: DeepImmutable<Vector3>,
value2: DeepImmutable<Vector3>,
value3: DeepImmutable<Vector3>,
value4: DeepImmutable<Vector3>,
amount: number,
): Vector3Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4" Example Playground https://playground.babylonjs.com/#R1F8YU#69
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
- value1: DeepImmutable<Vector3>
StaticCenter
-
Returns a new Vector3 located at the center between "value1" and "value2" Example Playground https://playground.babylonjs.com/#R1F8YU#72
Parameters
- value1: DeepImmutable<Vector3>
defines the first operand
- value2: DeepImmutable<Vector3>
defines the second operand
Returns Vector3
the new Vector3
- value1: DeepImmutable<Vector3>
StaticCenter To Ref
-
CenterToRef<T extends Vector3>(
value1: DeepImmutable<Vector3>,
value2: DeepImmutable<Vector3>,
ref: T,
): TGets the center of the vectors "value1" and "value2" and stores the result in the vector "ref" Example Playground https://playground.babylonjs.com/#R1F8YU#73
Type Parameters
- T extends Vector3
Parameters
- value1: DeepImmutable<Vector3>
defines first vector
- value2: DeepImmutable<Vector3>
defines second vector
- ref: T
defines third vector
Returns T
ref
StaticCheck Extends
-
Checks if a given vector is inside a specific range Example Playground https://playground.babylonjs.com/#R1F8YU#75
Parameters
Returns void
StaticClamp
-
Clamp(
value: DeepImmutable<Vector3>,
min: DeepImmutable<Vector3>,
max: DeepImmutable<Vector3>,
): Vector3Returns 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 Example Playground https://playground.babylonjs.com/#R1F8YU#76
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
- value: DeepImmutable<Vector3>
StaticClamp To Ref
-
ClampToRef<T extends Vector3>(
value: DeepImmutable<Vector3>,
min: DeepImmutable<Vector3>,
max: DeepImmutable<Vector3>,
result: T,
): TSets 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 Example Playground https://playground.babylonjs.com/#R1F8YU#77
Type Parameters
- T extends Vector3
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: T
defines the Vector3 where to store the result
Returns T
result input
StaticCross
-
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" Example Playground https://playground.babylonjs.com/#R1F8YU#15
Parameters
- left: DeepImmutable<Vector3>
defines the left operand
- right: DeepImmutable<Vector3>
defines the right operand
Returns Vector3
the cross product
- left: DeepImmutable<Vector3>
StaticCross To Ref
-
CrossToRef<T extends Vector3>(
left: DeepImmutable<Vector3>,
right: DeepImmutable<Vector3>,
result: T,
): TSets the given vector "result" with the cross product of "left" and "right" The cross product is then orthogonal to both "left" and "right" Example Playground https://playground.babylonjs.com/#R1F8YU#78
Type Parameters
- T extends Vector3
Parameters
- left: DeepImmutable<Vector3>
defines the left operand
- right: DeepImmutable<Vector3>
defines the right operand
- result: T
defines the Vector3 where to store the result
Returns T
result input
StaticDistance
-
Returns the distance between the vectors "value1" and "value2" Example Playground https://playground.babylonjs.com/#R1F8YU#81
Parameters
- value1: DeepImmutable<Vector3>
defines the first operand
- value2: DeepImmutable<Vector3>
defines the second operand
Returns number
the distance
- value1: DeepImmutable<Vector3>
StaticDistance Squared
-
Returns the squared distance between the vectors "value1" and "value2" Example Playground https://playground.babylonjs.com/#R1F8YU#80
Parameters
- value1: DeepImmutable<Vector3>
defines the first operand
- value2: DeepImmutable<Vector3>
defines the second operand
Returns number
the squared distance
- value1: DeepImmutable<Vector3>
StaticDot
-
Returns the dot product (float) between the vectors "left" and "right" Example Playground https://playground.babylonjs.com/#R1F8YU#82
Parameters
- left: DeepImmutable<Vector3>
defines the left operand
- right: DeepImmutable<Vector3>
defines the right operand
Returns number
the dot product
- left: DeepImmutable<Vector3>
StaticDown
-
Returns a new Vector3 set to (0.0, -1.0, 0.0) Example Playground https://playground.babylonjs.com/#R1F8YU#71
Returns Vector3
a new down Vector3
StaticForward
-
Returns a new Vector3 set to (0.0, 0.0, 1.0) Example Playground https://playground.babylonjs.com/#R1F8YU#71
Parameters
- rightHandedSystem: boolean = false
is the scene right-handed (negative z)
Returns Vector3
a new forward Vector3
- rightHandedSystem: boolean = false
StaticFrom Array
-
Returns a new Vector3 set from the index "offset" of the given array Example Playground https://playground.babylonjs.com/#R1F8YU#83
Parameters
- array: DeepImmutable<ArrayLike<number>>
defines the source array
- offset: number = 0
defines the offset in the source array
Returns Vector3
the new Vector3
- array: DeepImmutable<ArrayLike<number>>
StaticFrom Array To Ref
-
FromArrayToRef<T extends Vector3>(
array: DeepImmutable<ArrayLike<number>>,
offset: number,
result: T,
): TSets the given vector "result" with the element values from the index "offset" of the given array Example Playground https://playground.babylonjs.com/#R1F8YU#84
Type Parameters
- T extends Vector3
Parameters
- array: DeepImmutable<ArrayLike<number>>
defines the source array
- offset: number
defines the offset in the source array
- result: T
defines the Vector3 where to store the result
Returns T
result input
StaticFrom Float Array
-
Returns a new Vector3 set from the index "offset" of the given Float32Array
Parameters
- array: DeepImmutable<Float32Array>
defines the source array
Optionaloffset: numberdefines the offset in the source array
Returns Vector3
the new Vector3
- array: DeepImmutable<Float32Array>
StaticFrom Float Array To Ref
-
FromFloatArrayToRef<T extends Vector3>(
array: DeepImmutable<Float32Array>,
offset: number,
result: T,
): TSets the given vector "result" with the element values from the index "offset" of the given Float32Array
Type Parameters
- T extends Vector3
Parameters
- array: DeepImmutable<Float32Array>
defines the source array
- offset: number
defines the offset in the source array
- result: T
defines the Vector3 where to store the result
Returns T
result input
StaticFrom Floats To Ref
-
Sets the given vector "result" with the given floats. Example Playground https://playground.babylonjs.com/#R1F8YU#85
Type Parameters
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: T
defines the Vector3 where to store the result
Returns T
the result vector
- x: number
StaticGet Angle Between Vectors
-
GetAngleBetweenVectors(
vector0: DeepImmutable<Vector3>,
vector1: DeepImmutable<Vector3>,
normal: DeepImmutable<Vector3>,
): numberGet angle between two vectors Example Playground https://playground.babylonjs.com/#R1F8YU#86
Parameters
- vector0: DeepImmutable<Vector3>
the starting point
- vector1: DeepImmutable<Vector3>
the ending point
- normal: DeepImmutable<Vector3>
direction of the normal
Returns number
the angle between vector0 and vector1
- vector0: DeepImmutable<Vector3>
StaticGet Angle Between Vectors On Plane
-
GetAngleBetweenVectorsOnPlane(
vector0: DeepImmutable<Vector3>,
vector1: DeepImmutable<Vector3>,
normal: DeepImmutable<Vector3>,
): numberGet angle between two vectors projected on a plane Example Playground https://playground.babylonjs.com/#R1F8YU#87 Expectation compute time: 0.01 ms (median) and 0.02 ms (percentile 95%)
Parameters
- vector0: DeepImmutable<Vector3>
angle between vector0 and vector1
- vector1: DeepImmutable<Vector3>
angle between vector0 and vector1
- normal: DeepImmutable<Vector3>
Normal of the projection plane
Returns number
the angle in radians (float) between vector0 and vector1 projected on the plane with the specified normal
- vector0: DeepImmutable<Vector3>
StaticGet Clip Factor
-
GetClipFactor(
vector0: DeepImmutable<Vector3>,
vector1: DeepImmutable<Vector3>,
axis: DeepImmutable<Vector3>,
size: number,
): numberGet the clip factor between two vectors Example Playground https://playground.babylonjs.com/#R1F8YU#126
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
- vector0: DeepImmutable<Vector3>
StaticHermite
-
Hermite(
value1: DeepImmutable<Vector3>,
tangent1: DeepImmutable<Vector3>,
value2: DeepImmutable<Vector3>,
tangent2: DeepImmutable<Vector3>,
amount: number,
): Vector3Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2" Example Playground https://playground.babylonjs.com/#R1F8YU#89
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
- value1: DeepImmutable<Vector3>
StaticHermite1st Derivative
-
Hermite1stDerivative(
value1: DeepImmutable<Vector3>,
tangent1: DeepImmutable<Vector3>,
value2: DeepImmutable<Vector3>,
tangent2: DeepImmutable<Vector3>,
time: number,
): Vector3Returns a new Vector3 which is the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2". Example Playground https://playground.babylonjs.com/#R1F8YU#90
Parameters
- value1: DeepImmutable<Vector3>
defines the first control point
- tangent1: DeepImmutable<Vector3>
defines the first tangent
- value2: DeepImmutable<Vector3>
defines the second control point
- tangent2: DeepImmutable<Vector3>
defines the second tangent
- time: number
define where the derivative must be done
Returns Vector3
1st derivative
- value1: DeepImmutable<Vector3>
StaticHermite1st Derivative To Ref
-
Hermite1stDerivativeToRef<T extends Vector3>(
value1: DeepImmutable<Vector3>,
tangent1: DeepImmutable<Vector3>,
value2: DeepImmutable<Vector3>,
tangent2: DeepImmutable<Vector3>,
time: number,
result: T,
): TUpdate a Vector3 with the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2". Example Playground https://playground.babylonjs.com/#R1F8YU#91
Type Parameters
- T extends Vector3
Parameters
- value1: DeepImmutable<Vector3>
defines the first control point
- tangent1: DeepImmutable<Vector3>
defines the first tangent
- value2: DeepImmutable<Vector3>
defines the second control point
- tangent2: DeepImmutable<Vector3>
defines the second tangent
- time: number
define where the derivative must be done
- result: T
define where to store the derivative
Returns T
result input
StaticLeft
-
Returns a new Vector3 set to (-1.0, 0.0, 0.0) Example Playground https://playground.babylonjs.com/#R1F8YU#71
Returns Vector3
a new left Vector3
StaticLerp
-
Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end" Example Playground https://playground.babylonjs.com/#R1F8YU#95
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
- start: DeepImmutable<Vector3>
StaticLerp To Ref
-
LerpToRef<T extends Vector3>(
start: DeepImmutable<Vector3>,
end: DeepImmutable<Vector3>,
amount: number,
result: T,
): TSets the given vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end" Example Playground https://playground.babylonjs.com/#R1F8YU#93
Type Parameters
- T extends Vector3
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: T
defines the Vector3 where to store the result
Returns T
result input
StaticMaximize
-
Gets the maximal coordinate values between two Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#96
Parameters
- left: DeepImmutable<Vector3>
defines the first operand
- right: DeepImmutable<Vector3>
defines the second operand
Returns Vector3
the new Vector3
- left: DeepImmutable<Vector3>
StaticMinimize
-
Gets the minimal coordinate values between two Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#97
Parameters
- left: DeepImmutable<Vector3>
defines the first operand
- right: DeepImmutable<Vector3>
defines the second operand
Returns Vector3
the new Vector3
- left: DeepImmutable<Vector3>
StaticNormalize
-
Returns a new Vector3 as the normalization of the given vector Example Playground https://playground.babylonjs.com/#R1F8YU#98
Parameters
- vector: DeepImmutable<Vector3>
defines the Vector3 to normalize
Returns Vector3
the new Vector3
- vector: DeepImmutable<Vector3>
StaticNormalize To Ref
-
Sets the given vector "result" with the normalization of the given first vector Example Playground https://playground.babylonjs.com/#R1F8YU#98
Type Parameters
- T extends Vector3
Parameters
- vector: DeepImmutable<Vector3>
defines the Vector3 to normalize
- result: T
defines the Vector3 where to store the result
Returns T
result input
StaticOne
StaticPitch Yaw Roll To Move Between Points
-
Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point Example PG https://playground.babylonjs.com/#R1F8YU#188
Returns Vector3
the rotation in the form (pitch, yaw, 0)
StaticPitch Yaw Roll To Move Between Points To Ref
-
PitchYawRollToMoveBetweenPointsToRef<T extends Vector3>(
start: Vector3,
target: Vector3,
ref: T,
): TGets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point and stores it in the ref Vector3 Example PG https://playground.babylonjs.com/#R1F8YU#189
Type Parameters
- T extends Vector3
Parameters
Returns T
ref in the form (pitch, yaw, 0)
StaticProject
-
Project(
vector: DeepImmutable<Vector3>,
world: DeepImmutable<Matrix>,
transform: DeepImmutable<Matrix>,
viewport: DeepImmutable<Viewport>,
): Vector3Project a Vector3 onto screen space Example Playground https://playground.babylonjs.com/#R1F8YU#101
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
- vector: DeepImmutable<Vector3>
StaticProject On Triangle To Ref
-
ProjectOnTriangleToRef(
vector: DeepImmutable<Vector3>,
p0: DeepImmutable<Vector3>,
p1: DeepImmutable<Vector3>,
p2: DeepImmutable<Vector3>,
ref: Vector3,
): numberProjects "vector" on the triangle determined by its extremities "p0", "p1" and "p2", stores the result in "ref" and returns the distance to the projected point. Example Playground https://playground.babylonjs.com/#R1F8YU#104 From http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.104.4264&rep=rep1&type=pdf
Parameters
- vector: DeepImmutable<Vector3>
the vector to get distance from
- p0: DeepImmutable<Vector3>
extremity of the triangle
- p1: DeepImmutable<Vector3>
extremity of the triangle
- p2: DeepImmutable<Vector3>
extremity of the triangle
- ref: Vector3
variable to store the result to
Returns number
The distance between "ref" and "vector"
- vector: DeepImmutable<Vector3>
StaticProject To Ref
-
ProjectToRef<T extends Vector3>(
vector: DeepImmutable<Vector3>,
world: DeepImmutable<Matrix>,
transform: DeepImmutable<Matrix>,
viewport: DeepImmutable<Viewport>,
result: T,
): TProject a Vector3 onto screen space to reference Example Playground https://playground.babylonjs.com/#R1F8YU#102
Type Parameters
- T extends Vector3
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
- result: T
the vector in which the screen space will be stored
Returns T
result input
StaticRandom
-
Returns a new Vector3 with random values between min and max
Parameters
- min: number = 0
the minimum random value
- max: number = 1
the maximum random value
Returns Vector3
a Vector3 with random values between min and max
- min: number = 0
StaticRandom To Ref
StaticReflect
-
Reflects a vector off the plane defined by a normalized normal
Parameters
- inDirection: DeepImmutable<Vector3>
defines the vector direction
- normal: DeepImmutable<Vector3>
defines the normal - Must be normalized
Returns Vector3
the resulting vector
- inDirection: DeepImmutable<Vector3>
StaticReflect To Ref
-
ReflectToRef<T extends Vector3>(
inDirection: DeepImmutable<Vector3>,
normal: DeepImmutable<Vector3>,
ref: T,
): TReflects a vector off the plane defined by a normalized normal to reference
Type Parameters
- T extends Vector3
Parameters
- inDirection: DeepImmutable<Vector3>
defines the vector direction
- normal: DeepImmutable<Vector3>
defines the normal - Must be normalized
- ref: T
defines the Vector3 where to store the result
Returns T
the resulting vector
StaticRight
-
Returns a new Vector3 set to (1.0, 0.0, 0.0) Example Playground https://playground.babylonjs.com/#R1F8YU#71
Returns Vector3
a new right Vector3
StaticRotation From Axis
-
RotationFromAxis(
axis1: DeepImmutable<Vector3>,
axis2: DeepImmutable<Vector3>,
axis3: DeepImmutable<Vector3>,
): Vector3Given 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 Example Playground https://playground.babylonjs.com/#R1F8YU#106
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
- axis1: DeepImmutable<Vector3>
StaticRotation From Axis To Ref
-
RotationFromAxisToRef<T extends Vector3>(
axis1: DeepImmutable<Vector3>,
axis2: DeepImmutable<Vector3>,
axis3: DeepImmutable<Vector3>,
ref: T,
): TThe same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3 Example Playground https://playground.babylonjs.com/#R1F8YU#107
Type Parameters
- T extends Vector3
Parameters
- axis1: DeepImmutable<Vector3>
defines the first axis
- axis2: DeepImmutable<Vector3>
defines the second axis
- axis3: DeepImmutable<Vector3>
defines the third axis
- ref: T
defines the Vector3 where to store the result
Returns T
result input
StaticSlerp To Ref
-
SlerpToRef<T extends Vector3 = Vector3>(
vector0: Vector3,
vector1: Vector3,
slerp: number,
result: T,
): TSlerp between two vectors. See also
SmoothToRefSlerp is a spherical linear interpolation giving a slow in and out effect Example Playground 1 https://playground.babylonjs.com/#R1F8YU#108 Example Playground 2 https://playground.babylonjs.com/#R1F8YU#109Type Parameters
Parameters
Returns T
The slerped vector
StaticSmooth To Ref
StaticTransform Coordinates
-
TransformCoordinates(
vector: DeepImmutable<Vector3>,
transformation: DeepImmutable<Matrix>,
): Vector3Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector. This method computes transformed coordinates only, not transformed direction vectors (ie. it takes translation in account) Example Playground https://playground.babylonjs.com/#R1F8YU#111
Parameters
- vector: DeepImmutable<Vector3>
defines the Vector3 to transform
- transformation: DeepImmutable<Matrix>
defines the transformation matrix
Returns Vector3
the transformed Vector3
- vector: DeepImmutable<Vector3>
StaticTransform Coordinates From Floats To Ref
-
TransformCoordinatesFromFloatsToRef<T extends Vector3>(
x: number,
y: number,
z: number,
transformation: DeepImmutable<Matrix>,
result: T,
): TSets 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 transformed coordinates only, not transformed direction vectors Example Playground https://playground.babylonjs.com/#R1F8YU#115
Type Parameters
- T extends Vector3
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: T
defines the Vector3 where to store the result
Returns T
result input
StaticTransform Coordinates To Ref
-
TransformCoordinatesToRef<T extends Vector3>(
vector: DeepImmutable<Vector3>,
transformation: DeepImmutable<Matrix>,
result: T,
): TSets the given vector "result" coordinates with the result of the transformation by the given matrix of the given vector This method computes transformed coordinates only, not transformed direction vectors (ie. it takes translation in account) Example Playground https://playground.babylonjs.com/#R1F8YU#113
Type Parameters
- T extends Vector3
Parameters
- vector: DeepImmutable<Vector3>
defines the Vector3 to transform
- transformation: DeepImmutable<Matrix>
defines the transformation matrix
- result: T
defines the Vector3 where to store the result
Returns T
result input
StaticTransform Normal
-
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) Example Playground https://playground.babylonjs.com/#R1F8YU#112
Parameters
- vector: DeepImmutable<Vector3>
defines the Vector3 to transform
- transformation: DeepImmutable<Matrix>
defines the transformation matrix
Returns Vector3
the new Vector3
- vector: DeepImmutable<Vector3>
StaticTransform Normal From Floats To Ref
-
TransformNormalFromFloatsToRef<T extends Vector3>(
x: number,
y: number,
z: number,
transformation: DeepImmutable<Matrix>,
result: T,
): TSets 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) Example Playground https://playground.babylonjs.com/#R1F8YU#116
Type Parameters
- T extends Vector3
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: T
defines the Vector3 where to store the result
Returns T
result input
StaticTransform Normal To Ref
-
TransformNormalToRef<T extends Vector3>(
vector: DeepImmutable<Vector3>,
transformation: DeepImmutable<Matrix>,
result: T,
): TSets 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) Example Playground https://playground.babylonjs.com/#R1F8YU#114
Type Parameters
- T extends Vector3
Parameters
- vector: DeepImmutable<Vector3>
defines the Vector3 to transform
- transformation: DeepImmutable<Matrix>
defines the transformation matrix
- result: T
defines the Vector3 where to store the result
Returns T
result input
StaticUnproject
-
Unproject(
source: DeepImmutable<Vector3>,
viewportWidth: number,
viewportHeight: number,
world: DeepImmutable<Matrix>,
view: DeepImmutable<Matrix>,
projection: DeepImmutable<Matrix>,
): Vector3Unproject from screen space to object space Example Playground https://playground.babylonjs.com/#R1F8YU#117
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
- source: DeepImmutable<Vector3>
StaticUnproject Floats To Ref
-
UnprojectFloatsToRef<T extends Vector3>(
sourceX: number,
sourceY: number,
sourceZ: number,
viewportWidth: number,
viewportHeight: number,
world: DeepImmutable<Matrix>,
view: DeepImmutable<Matrix>,
projection: DeepImmutable<Matrix>,
result: T,
): TUnproject from screen space to object space Example Playground https://playground.babylonjs.com/#R1F8YU#120
Type Parameters
- T extends Vector3
Parameters
- sourceX: number
defines the screen space x coordinate to use
- sourceY: number
defines the screen space y coordinate to use
- sourceZ: number
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: T
defines the Vector3 where to store the result
Returns T
result input
StaticUnproject From Transform
-
UnprojectFromTransform(
source: DeepImmutable<Vector3>,
viewportWidth: number,
viewportHeight: number,
world: DeepImmutable<Matrix>,
transform: DeepImmutable<Matrix>,
): Vector3Unproject from screen space to object space Example Playground https://playground.babylonjs.com/#R1F8YU#121
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)
- transform: DeepImmutable<Matrix>
defines the transform (view x projection) matrix to use
Returns Vector3
the new Vector3
- source: DeepImmutable<Vector3>
StaticUnproject To Ref
-
UnprojectToRef<T extends Vector3>(
source: DeepImmutable<Vector3>,
viewportWidth: number,
viewportHeight: number,
world: DeepImmutable<Matrix>,
view: DeepImmutable<Matrix>,
projection: DeepImmutable<Matrix>,
result: T,
): TUnproject from screen space to object space Example Playground https://playground.babylonjs.com/#R1F8YU#119
Type Parameters
- T extends Vector3
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: T
defines the Vector3 where to store the result
Returns T
result input
StaticUp
-
Returns a new Vector3 set to (0.0, 1.0, 0.0) Example Playground https://playground.babylonjs.com/#R1F8YU#71
Returns Vector3
a new up Vector3
Class used to store (x,y,z) vector representation A Vector3 is the main object used in 3D geometry It can represent either the coordinates of a point the space, either a direction Reminder: js uses a left handed forward facing system Example Playground - Overview - https://playground.babylonjs.com/#R1F8YU