{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Class Math | Unity Physics | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Math

    Helper functions.

    Inheritance
    object
    Math
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Physics
    Assembly: solution.dll
    Syntax
    public static class Math

    Methods

    Name Description
    CalculatePerpendicularNormalized(float3, out float3, out float3)

    Return two normals perpendicular to the input vector.

    CalculateTwistAngle(quaternion, int)

    Returns the twist angle of the swing-twist decomposition of q about i, j, or k corresponding to index = 0, 1, or 2 respectively. Full calculation for readability: float invLength = RSqrtSafe(dot * dot + w * w); float sinHalfAngle = dot * invLength; float cosHalfAngle = w * invLength; Observe: invLength cancels in the tan^-1(sin / cos) calc, so avoid unnecessary calculations.

    ClampToMaxLength(float, ref float3)

    Clamps the vector to to maximum length.

    DecomposeRigidBodyOrientation(in float4x4)

    Physics internally represents all rigid bodies in world space. If a static body is in a hierarchy, its local-to-world matrix must be decomposed when building the physics world. This method returns a world-space orientation that would be decomposed for such a rigid body.

    DecomposeRigidBodyTransform(in float4x4)

    Physics internally represents all rigid bodies in world space. If a static body is in a hierarchy, its local-to-world matrix must be decomposed when building the physics world. This method returns a world-space RigidTransform that would be decomposed for such a rigid body.

    DecomposeScale(float4x4)

    Obtain 3-dimensional scale vector of the provided 4x4 transformation matrix, the components of which represent the lengths of the three orthonormal basis vectors forming the 3x3 rotational sub-matrix, respectively.

    HasNonIdentityScale(float4x4, float)

    Checks if the matrix has non-identity scale.

    HasNonUniformScale(float4x4, float)

    Checks if the matrix has non-uniform scale.

    HasShear(float4x4)

    Checks if the matrix has shear.

    Inverse(MTransform)

    Inverses the given transform.

    Inverse(ScaledMTransform)

    Inverses the given transform.

    IsNormalized(float3)

    Check if 'v' is normalized.

    Mul(MTransform, float3)

    Multiplies the point by the transform.

    Mul(MTransform, MTransform)

    Returns cFromA = cFromB * bFromA.

    Mul(ScaledMTransform, float3)

    Multiplies the point by the transform.

    Mul(ScaledMTransform, ScaledMTransform)

    Returns cFromA = cFromB * bFromA.

    NormalizeWithLength(float3, out float3)

    Normalize and return the lenght of a vector.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)