Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to transport BABYLON.Vector3 information for pointer events

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a new Vector3WithInfo

    Parameters

    • source: Vector3

      defines the vector3 data to transport

    • Optional buttonIndex: number

      defines the current mouse button index

    Returns Vector3WithInfo

Properties

buttonIndex: number

defines the current mouse button index

Accessors

  • 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

  • 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

  • get x(): number
  • set x(value: number): void
  • Gets or sets the x coordinate

    Returns number

  • Gets or sets the x coordinate

    Parameters

    • value: number

    Returns void

  • get y(): number
  • set y(value: number): void
  • Gets or sets the y coordinate

    Returns number

  • Gets or sets the y coordinate

    Parameters

    • value: number

    Returns void

  • get z(): number
  • set z(value: number): void
  • Gets or sets the z coordinate

    Returns number

  • Gets or sets the z coordinate

    Parameters

    • value: number

    Returns void

  • Gets a down Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a backward Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a forward Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a left Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a one Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a backward Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a forward Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a right Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets an up Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

  • Gets a zero Vector3 that must not be updated

    Returns DeepImmutableObject<Vector3>

Methods

  • applyRotationQuaternionToRef<T>(q: Quaternion, result: T): T
  • asArray(): number[]
  • 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 Vector3WithInfo

    the current updated Vector3

  • equalsToFloats(x: number, y: number, z: number): boolean
  • 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

  • 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: DeepImmutableObject<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

  • getClassName(): string
  • Gets the class name

    Returns string

    the string "Vector3"

  • getHashCode(): number
  • Creates the Vector3 hash code

    Returns number

    a number which tends to be unique between Vector3 instances

  • 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

    Returns Vector3

  • 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(): number
  • lengthSquared(): number
  • maximizeInPlaceFromFloats(x: number, y: number, z: number): Vector3WithInfo
  • 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 Vector3WithInfo

    the current updated Vector3

  • minimizeInPlaceFromFloats(x: number, y: number, z: number): Vector3WithInfo
  • 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 Vector3WithInfo

    the current updated Vector3

  • 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 Vector3WithInfo

    the new Vector3

  • negateToRef<T>(result: T): T
  • normalizeToRef<T>(reference: T): T
  • 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

    Type Parameters

    Parameters

    • plane: Plane

      defines the plane to project to

    • origin: Vector3

      defines the origin of the projection ray

    Returns T

    the projected vector3

  • projectOnPlaneToRef<T>(plane: Plane, origin: Vector3, result: T): T
  • 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

    Parameters

    • plane: Plane

      defines the plane to project to

    • origin: Vector3

      defines the origin of the projection ray

    • result: T

      defines the Vector3 where to store the result

    Returns T

    result input

  • rotateByQuaternionAroundPointToRef<T>(quaternion: Quaternion, point: Vector3, result: T): T
  • rotateByQuaternionToRef<T>(quaternion: Quaternion, result: T): T
  • scaleAndAddToRef<T>(scale: number, result: T): T
  • 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

    Parameters

    • scale: number

      defines the scale factor

    • result: T

      defines the Vector3 object where to store the result

    Returns T

    result input

  • scaleToRef<T>(scale: number, result: T): T
  • 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

    Parameters

    • scale: number

      defines the multiplier factor

    • result: T

      defines the Vector3 object where to store the result

    Returns T

    the result

  • 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 Vector3WithInfo

    the current updated Vector3

  • 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 Vector3WithInfo

    the resulting Vector3

  • subtractFromFloatsToRef<T>(x: number, y: number, z: number, result: T): T
  • Subtracts 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

    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

  • 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

    • Optional index: number

      defines the offset in the destination array

    Returns Vector3WithInfo

    the current Vector3

  • toString(): string
  • Backward(rightHandedSystem?: boolean): Vector3
  • 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 Example Playground https://playground.babylonjs.com/#R1F8YU#76

    Type Parameters

    Parameters

    Returns T

    the new Vector3

  • 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 Example Playground https://playground.babylonjs.com/#R1F8YU#77

    Type Parameters

    Parameters

    Returns T

    result input

  • Forward(rightHandedSystem?: boolean): Vector3
  • Sets 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

    Parameters

    • array: DeepImmutableObject<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

  • Returns a new Vector3 set from the index "offset" of the given Float32Array

    deprecated

    Please use FromArray instead.

    Parameters

    • array: DeepImmutableObject<Float32Array>

      defines the source array

    • Optional offset: number

      defines the offset in the source array

    Returns Vector3

    the new Vector3

  • Sets the given vector "result" with the element values from the index "offset" of the given Float32Array

    deprecated

    Please use FromArrayToRef instead.

    Type Parameters

    Parameters

    • array: DeepImmutableObject<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

  • FromFloatsToRef<T>(x: number, y: number, z: number, result: T): T
  • 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

  • Get 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: Vector3

      angle between vector0 and vector1

    • vector1: Vector3

      angle between vector0 and vector1

    • normal: 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

  • Returns a new Vector3 set to (1.0, 1.0, 1.0)

    Returns Vector3

    a new Vector3

  • PitchYawRollToMoveBetweenPointsToRef<T>(start: Vector3, target: Vector3, ref: T): T
  • Random(min?: number, max?: number): Vector3
  • Returns a new Vector3 with random values between min and max

    Parameters

    • Optional min: number

      the minimum random value

    • Optional max: number

      the maximum random value

    Returns Vector3

    a Vector3 with random values between min and max

  • SlerpToRef<T>(vector0: Vector3, vector1: Vector3, slerp: number, result: T): T
  • SmoothToRef<T>(source: Vector3, goal: Vector3, deltaTime: number, lerpTime: number, result: T): T
  • TransformCoordinatesFromFloatsToRef<T>(x: number, y: number, z: number, transformation: DeepImmutableObject<Matrix>, result: T): T
  • 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 transformed coordinates only, not transformed direction vectors Example Playground https://playground.babylonjs.com/#R1F8YU#115

    Type Parameters

    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: DeepImmutableObject<Matrix>

      defines the transformation matrix

    • result: T

      defines the Vector3 where to store the result

    Returns T

    result input

  • Sets 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

    Parameters

    Returns T

    result input

  • TransformNormalFromFloatsToRef<T>(x: number, y: number, z: number, transformation: DeepImmutableObject<Matrix>, result: T): T
  • 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) Example Playground https://playground.babylonjs.com/#R1F8YU#116

    Type Parameters

    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: DeepImmutableObject<Matrix>

      defines the transformation matrix

    • result: T

      defines the Vector3 where to store the result

    Returns T

    result input

  • Unproject from screen space to object space Example Playground https://playground.babylonjs.com/#R1F8YU#120

    Type Parameters

    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: DeepImmutableObject<Matrix>

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

    • view: DeepImmutableObject<Matrix>

      defines the view matrix to use

    • projection: DeepImmutableObject<Matrix>

      defines the projection matrix to use

    • result: T

      defines the Vector3 where to store the result

    Returns T

    result input

  • Returns a new Vector3 set to (0.0, 0.0, 0.0)

    Returns Vector3

    a new empty Vector3

Legend

  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static method

Settings

Theme