• Studio

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • API

    Datatypes

    Edit

    Vector3

    Vector3 represents three-dimensional space as coordinates, physical quantities, or directions, containing three numerical components (x, y, and z). It is used in Unity for physics, animations, and transformations.

    Properties

    Returns a version of this Vector3 with a magnitude of one, maintaining its direction. Useful for unit direction vectors.

    magnitude

    number

    Provides the length of a Vector3, calculated as the Euclidean distance to (0,0,0), useful for distance calculations in 3D space.

    Returns the square of the magnitude, an alternative for performance-sensitive calculations where exact distance is not necessary.

    x

    number

    ServerAndClient

    Represents the x-coordinate of the Vector3, allowing direct manipulation or reading of its x-component.

    y

    number

    ServerAndClient

    Corresponds to the y-coordinate of the Vector3, for manipulating or reading the y-component.

    z

    number

    ServerAndClient

    Represents the z-coordinate of the Vector3, used for direct manipulation or reading of the z-component.

    Generates a Vector3 with zero values for all coordinates, representing the origin in 3D space or indicating no motion or rotation.

    Generates a Vector3 object with all components set to 1, useful for pointing diagonally in 3D space.

    Returns a Vector3 pointing towards the positive Z-axis, useful for designating a forward direction.

    Provides a Vector3 pointing towards the negative Z-axis, often used to designate a backward direction.

    Offers a Vector3 pointing upwards along the positive Y-axis, handy for upward movements or orientations.

    Represents a Vector3 pointing downwards along the negative Y-axis, typically used for downward directions.

    Returns a Vector3 pointing in the negative X-axis direction, used to signify left direction in 3D space.

    Provides a Vector3 pointing towards the positive X-axis, recognized as the right direction in 3D space.

    Yields a Vector3 with all components set to positive infinity, useful for representing very large values.

    Generates a Vector3 with all components set to negative infinity, representing the smallest possible values in 3D space.

    Provides a very small positive number, used for comparisons to determine if Vector3 components are approximately zero, considering floating-point inaccuracies.

    A small positive number used in square root calculations, representing a negligible threshold value for comparing Vector3 magnitudes.

    Methods

    Changes the x, y, and z values of an existing Vector3 object, useful for simultaneous updates to all three components.

    Parameters

    newX

    number

    The new value for the x-coordinate.

    newY

    number

    The new value for the y-coordinate.

    newZ

    number

    The new value for the z-coordinate.

    Returns

    void

    Multiplies each component of the Vector3 by the corresponding components of another Vector3, used to alter the scale without changing its direction.

    Parameters

    scale
    Vector3

    A Vector3 by which the instance vector is scaled.

    Returns

    void

    Adjusts the Vector3 to a length of one while maintaining its direction, useful for when only the direction is of interest.

    Returns

    void

    Creates a smooth transition between two Vector3 points on a sphere's surface, ideal for smooth transitions in rotations or positions.

    Parameters

    The starting Vector3 point.

    The ending Vector3 point.

    t

    number

    The interpolation factor between 0 and 1.

    Returns

    Vector3

    A Vector3 point along the shortest path between 'a' and 'b'.

    Similar to 'Slerp' but allows the 't' value to exceed the 0 to 1 range, enabling extrapolation beyond the original points.

    Parameters

    The starting Vector3 point.

    The ending Vector3 point.

    t

    number

    An extrapolation factor beyond 0 and 1.

    Returns

    Vector3

    A new Vector3 point potentially extrapolated beyond 'b'.

    Gradually rotates a Vector3 'current' to align with a 'target' Vector3, with specified maximum rotation and magnitude change limits.

    Parameters

    current
    Vector3

    The current Vector3 from which rotation starts.

    target
    Vector3

    The target Vector3 towards which rotation is aimed.

    maxRadiansDelta

    number

    Maximum rotation allowed in radians.

    maxMagnitudeDelta

    number

    Maximum change in magnitude allowed.

    Returns

    Vector3

    The Vector3 after rotating towards the target.

    Performs linear interpolation between two Vector3s, transitioning from 'a' to 'b' based on the 't' ratio.

    Parameters

    The starting Vector3 point.

    The ending Vector3 point.

    t

    number

    The interpolation factor, in the range 0 to 1.

    Returns

    Vector3

    A new Vector3 point interpolated between 'a' and 'b'.

    Similar to 'Lerp', this method performs linear interpolation between two points, but allows 't' to exceed the 0 to 1 range, enabling extrapolation.

    Parameters

    The starting Vector3 point.

    The ending Vector3 point.

    t

    number

    The interpolation factor, not limited to between 0 and 1.

    Returns

    Vector3

    A new Vector3 point interpolated (or extrapolated) between 'a' and 'b'.

    Moves a Vector3 ('current') incrementally towards a target Vector3 ('target') at a specified 'maxDistanceDelta'.

    Parameters

    current
    Vector3

    The current Vector3 to move.

    target
    Vector3

    The target Vector3 to move towards.

    maxDistanceDelta

    number

    The maximum distance the Vector3 can move in one call.

    Returns

    Vector3

    A Vector3 moved towards the target.

    Creates a new Vector3 from the product of corresponding components of two given Vector3s, affecting the size without changing direction.

    Parameters

    The first Vector3 used for scaling.

    The second Vector3 used for scaling.

    Returns

    Vector3

    The resulting Vector3 after scaling.

    Calculates the cross product of two Vector3 instances, resulting in a Vector3 perpendicular to both, used for finding normals or rotation axes.

    Parameters

    The first Vector3 to cross.

    The second Vector3 to cross.

    Returns

    Vector3

    The cross product of the two Vector3s.

    Reflects a Vector3 off a surface with a specified normal, useful for simulating reflections or ricochets.

    Parameters

    inDirection
    Vector3

    The incoming Vector3 to reflect.

    inNormal
    Vector3

    The normal Vector3 off which to reflect.

    Returns

    Vector3

    The reflected Vector3.

    Normalizes a Vector3, returning a new Vector3 with the same direction but a magnitude of 1, useful for direction without magnitude concern.

    Parameters

    value
    Vector3

    The Vector3 to normalize.

    Returns

    Vector3

    A normalized version of the input Vector3.

    Calculates the Dot Product of two Vector3s, useful for determining directional alignment or the angle between vectors.

    Parameters

    The first Vector3 for the dot product.

    The second Vector3 for the dot product.

    Returns

    number

    The dot product of the two Vector3s.

    Projects a Vector3 onto another, useful for finding the component of one vector in the direction of another.

    Parameters

    vector
    Vector3

    The Vector3 being projected.

    onNormal
    Vector3

    The Vector3 on which the projection occurs.

    Returns

    Vector3

    The projection of the first Vector3 onto the second.

    Projects a Vector3 onto a plane defined by a normal orthogonal Vector3, useful for aligning objects to surfaces.

    Parameters

    vector
    Vector3

    The Vector3 being projected onto a plane.

    planeNormal
    Vector3

    The normal Vector3 of the plane onto which the projection occurs.

    Returns

    Vector3

    The Vector3 after being projected onto a plane.

    Calculates the angle in degrees between two Vector3s, useful for determining the required rotation to align one Vector3 with another.

    Parameters

    The origin Vector3 for angle measurement.

    The destination Vector3 for angle measurement.

    Returns

    number

    The angle in degrees between the two Vector3s.

    Calculates the angle between two Vector3s with a sign indicating rotation direction around a given axis.

    Parameters

    The Vector3 from where the angle measurement starts.

    The Vector3 to which the angle measurement is made.

    The axis around which the rotation angle is measured.

    Returns

    number

    The signed angle in degrees between the two Vector3s.

    Calculates the distance between two Vector3 points, typically used to determine how far apart two objects are in 3D space.

    Parameters

    The first Vector3 point.

    The second Vector3 point.

    Returns

    number

    The distance between the two Vector3 points.

    Limits the magnitude of a Vector3 to a specified maximum, useful for constraining movement or other vector magnitudes.

    Parameters

    vector
    Vector3

    The Vector3 to clamp.

    maxLength

    number

    The maximum length to which the Vector3's magnitude is clamped.

    Returns

    Vector3

    The Vector3 with its magnitude clamped.

    Returns the magnitude (length) of a Vector3, useful for distance calculations from the origin.

    Parameters

    vector
    Vector3

    The Vector3 of which to calculate the magnitude.

    Returns

    number

    The magnitude of the Vector3.

    Calculates the square of the magnitude of a Vector3, often used for performance reasons in relative length comparisons.

    Parameters

    vector
    Vector3

    The Vector3 of which to calculate the square of the magnitude.

    Returns

    number

    The square of the magnitude of the Vector3.

    Returns a Vector3 composed of the smallest x, y, and z components from two given Vector3s, useful for bounding calculations.

    Parameters

    The first Vector3 for comparison.

    The second Vector3 for comparison.

    Returns

    Vector3

    A Vector3 made up of the smallest components from the two input Vector3s.

    Produces a Vector3 from the largest x, y, and z components of two given Vector3s, useful for defining bounds or extents.

    Parameters

    The first of two Vector3s to compare.

    The second of two Vector3s to compare.

    Returns

    Vector3

    A Vector3 composed of the largest components of the two compared Vector3s.

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.