Creates a new AnimatedVector3 instance.
A map containing animation samplers keyed by track names
The name of the initial active animation track
Internal typed array storage for vector components
Whether the animation should loop when it reaches the end.
Gets the current blending ratio between animation tracks.
The blending ratio between 0 and 1
Sets the blending ratio between the first and second animation tracks.
A value between 0 and 1, where 0 means only the first track is used and 1 means only the second track is used
Gets the number of bytes per component.
The number of bytes per component (4 for Float32Array, 8 for Float64Array)
Gets the class name.
The class name "Vector3"
Gets the GLSL representation of this vector as a float vec3.
A string representation suitable for GLSL shaders
Gets the GLSL representation of this vector as an integer ivec3.
A string representation suitable for GLSL shaders with integer components
Gets the W component of the vector (always returns 1 for homogeneous coordinates).
Always returns 1
Gets the WGSL representation of this vector as a float vec3f.
A string representation suitable for WGSL shaders
Gets the WGSL representation of this vector as an integer vec3i.
A string representation suitable for WGSL shaders with integer components
Gets the X component of the vector.
This getter automatically triggers an update to ensure the value reflects the current animation state.
The current X component value
Gets the Y component of the vector.
This getter automatically triggers an update to ensure the value reflects the current animation state.
The current Y component value
Gets the Z component of the vector.
This getter automatically triggers an update to ensure the value reflects the current animation state.
The current Z component value
StaticcompositionGets the composition type for this vector class.
The composition type (Vec3)
Gets the component at the specified index.
The index (0 for x, 1 for y, 2 for z)
The component value at the specified index
Creates a copy of this vector.
A new vector with the same components
Removes an animation sampler for the specified track.
The name of the animation track to remove
Calculates the dot product of this vector with another vector.
The vector to calculate dot product with
The dot product result
Converts the vector to a flat array.
An array containing the x, y, and z components
Gets all available animation track names.
An array containing all animation track names
Gets the animation sampler for the specified track.
The name of the animation track
The animation sampler for the specified track
Gets the name of the first (primary) active animation track.
The name of the first active animation track
Returns the vector components as a regular JavaScript array.
An array containing the x, y, and z components
Gets the name of the second (secondary) active animation track.
The name of the second active animation track, or undefined if not set
Checks if this vector is a dummy vector (empty).
True if the vector is dummy (has no components), false otherwise
Checks if this vector is approximately equal to another vector within a tolerance.
The vector to compare with
The tolerance for comparison (default: Number.EPSILON)
True if vectors are approximately equal, false otherwise
Checks if this vector is strictly equal to another vector (exact comparison).
The vector to compare with
True if vectors are exactly equal, false otherwise
Checks if the internal storage shares the same ArrayBuffer as the provided one. Useful for determining if vectors share underlying memory.
The ArrayBuffer to compare against
True if the same ArrayBuffer is used, false otherwise
Calculates the length (magnitude) of the vector.
The length of the vector
Calculates the squared length of the vector. This is more efficient than calculating the actual length when only comparison is needed.
The squared length of the vector
Calculates the distance from this vector to another vector.
The target vector
The distance between the vectors
Sets or updates an animation sampler for the specified track.
The name of the animation track
The animation sampler to associate with the track
Sets the first (primary) active animation track.
The name of the animation track to set as primary
Sets the vector values from a Float32Array and triggers an update.
A Float32Array containing the new x, y, z values
Sets the second (secondary) active animation track for blending.
The name of the animation track to set as secondary
Sets the current animation time and triggers an update.
When a specific time is set, the vector will use this time instead of the global animation time for interpolation calculations.
The time value in seconds
Converts the vector to a string representation.
A string representation of the vector in the format "(x, y, z)"
Converts the vector to an approximate string representation with limited decimal places.
A string representation with financial formatting
Updates the vector values based on the current animation state.
This method interpolates values from the active animation tracks using the current time. If two tracks are active, it blends them according to the blending ratio. The method handles looping and caches results to avoid unnecessary recalculations.
Clears the specific time and uses the default time (0) for animation updates. When used with AnimationComponent, the time will be set via setTime() during animation processing.
Gets the component value at the specified index. Alias for the at() method for convenience.
The index of the component to retrieve
The component value at the given index
Static_Adds two vectors component-wise (static version).
The first vector
The second vector
The typed array constructor to use
A new vector containing the sum
Static_Calculates the cross product of two vectors (static version).
The first vector (left operand)
The second vector (right operand)
The typed array constructor to use
A new vector containing the cross product result
Static_Divides a vector by a scalar value (static version).
The vector to divide
The scalar value to divide by
The typed array constructor to use
A new vector containing the divided result
Static_Divides two vectors component-wise (static version).
The vector to divide
The vector to divide by
The typed array constructor to use
A new vector containing the component-wise division result
Static_Creates an empty dummy vector for placeholder purposes.
The typed array constructor to use
A new dummy vector
Static_Creates a vector from individual x, y, z components.
The x component
The y component
The z component
The typed array constructor to use
A new vector
Static_Creates a vector from an array (takes first 3 elements).
The array containing the components
The typed array constructor to use
A new vector
Static_Creates a vector from a 3-element array.
The array containing x, y, z components
The typed array constructor to use
A new vector
Static_Creates a vector by copying from another Vector3.
The source vector to copy from
The typed array constructor to use
A new vector
Static_Creates a Vector3 from a Vector4 (drops the w component).
The source Vector4 to copy from
The typed array constructor to use
A new vector
Static_Creates a Vector3 from a Vector2 (sets z component to 0).
The source Vector2 to copy from
The typed array constructor to use
A new vector
Static_Performs linear interpolation between two vectors (static version).
The start vector
The end vector
The interpolation ratio (0.0 to 1.0)
The typed array constructor to use
A new vector containing the interpolated result
Static_Multiplies a vector by a scalar value (static version).
The vector to multiply
The scalar value to multiply by
The typed array constructor to use
A new vector containing the scaled result
Static_Transforms a 3D vector by a 4x4 matrix, treating the vector as a point (w=1). The result is perspective-divided if the w component is not 1.
The vector to transform
The 4x4 transformation matrix
The typed array constructor to use
A new transformed vector
Static_Transforms a vector by a quaternion rotation (static version). This applies the quaternion rotation to the vector.
The quaternion to apply
The vector to transform
The typed array constructor to use
A new vector containing the transformed result
Static_Multiplies two vectors component-wise (static version).
The first vector
The second vector
The typed array constructor to use
A new vector containing the component-wise product
Static_Normalizes a vector to unit length (static version).
The vector to normalize
The typed array constructor to use
A new normalized vector
Static_Creates a vector with all components set to 1 (1, 1, 1).
The typed array constructor to use
A new vector with all components set to 1
Static_Subtracts the second vector from the first vector (static version).
The vector to subtract from
The vector to subtract
The typed array constructor to use
A new vector containing the difference
Static_Creates a zero vector (0, 0, 0).
The typed array constructor to use
A new zero vector
StaticaddStaticaddAdds a scaled vector to another vector and stores the result in the output vector.
The vector to add to
The vector to add
The scale to apply to the second vector
The output vector to store the result
The output vector containing the sum
StaticaddAdds two vectors and stores the result in the output vector.
The first vector
The second vector
The output vector to store the result
The output vector containing the sum
StaticangleStaticcrossStaticcrossCalculates the cross product of two vectors and stores the result in the output vector.
The first vector (left operand)
The second vector (right operand)
The output vector to store the result
The output vector containing the cross product result
StaticdivideStaticdivideDivides a vector by a scalar and stores the result in the output vector.
The vector to divide
The scalar value to divide by
The output vector to store the result
The output vector containing the divided result
StaticdivideStaticdivideDivides two vectors component-wise and stores the result in the output vector.
The vector to divide
The vector to divide by
The output vector to store the result
The output vector containing the component-wise division result
StaticdotStaticdummyStaticfromCreates a vector from an ArrayBuffer.
The ArrayBuffer containing the vector data
A new Vector3 instance
StaticfromCreates a vector with all components set to the same value.
The value to set for all components
A new Vector3 instance
StaticfromCreates a vector from individual x, y, z components.
The x component
The y component
The z component
A new Vector3 instance
StaticfromCreates a vector from an array (takes first 3 elements).
The array containing the components
A new Vector3 instance
StaticfromStaticfromCreates a vector by copying data from a Float32Array.
The Float32Array to copy from
A new Vector3 instance
StaticfromStaticfromStaticfromCreates a vector from a Float32Array.
The Float32Array containing the vector data
A new Vector3 instance
StaticlengthStaticlengthCalculates the squared length of a vector (static version). This is more efficient than calculating the actual length when only comparison is needed.
The vector to calculate squared length for
The squared length of the vector
StaticlerpStaticmultiplyStaticmultiplyStaticmultiplyTransforms a 3D vector by a 4x4 matrix, treating the vector as a point (w=1). The result is perspective-divided if the w component is not 1.
The vector to transform
The 4x4 transformation matrix
The output vector to store the result
A new transformed vector
StaticmultiplyTransforms a vector by a quaternion rotation.
The quaternion to apply
The vector to transform
A new Vector3 instance containing the transformed result
StaticmultiplyTransforms a vector by a quaternion rotation and stores the result in the output vector. This applies the quaternion rotation to the vector.
The quaternion to apply
The vector to transform
The output vector to store the result
The output vector containing the transformed result
StaticmultiplyMultiplies a vector by a scalar and stores the result in the output vector.
The vector to multiply
The scalar value to multiply by
The output vector to store the result
The output vector containing the scaled result
StaticmultiplyStaticmultiplyMultiplies two vectors component-wise and stores the result in the output vector.
The first vector
The second vector
The output vector to store the result
The output vector containing the component-wise product
StaticnormalizeStaticnormalizeNormalizes a vector and stores the result in the output vector.
The vector to normalize
The output vector to store the result
The output vector containing the normalized result
StaticoneCreates a vector with all components set to 1 (1, 1, 1).
A new Vector3 instance with all components set to 1
StaticsubtractStaticsubtractSubtracts two vectors and stores the result in the output vector.
The vector to subtract from
The vector to subtract
The output vector to store the result
The output vector containing the difference
Staticzero
An animated 3D vector that interpolates values based on animation tracks.
This class extends Vector3 to provide animation capabilities, allowing the vector to change its values over time based on animation samplers. It supports blending between two animation tracks and can operate in looped or non-looped modes.
Example