docs.unity3d.com
    Show / Hide Table of Contents

    Class Math

    Inheritance
    Object
    Math
    Namespace: Unity.Physics
    Syntax
    public static class Math : object

    Methods

    CalculatePerpendicularNormalized(float3, out float3, out float3)

    Declaration
    public static void CalculatePerpendicularNormalized(float3 v, out float3 p, out float3 q)
    Parameters
    Type Name Description
    float3 v
    float3 p
    float3 q

    CalculateTwistAngle(quaternion, Int32)

    Declaration
    public static float CalculateTwistAngle(quaternion q, int twistAxisIndex)
    Parameters
    Type Name Description
    quaternion q
    Int32 twistAxisIndex
    Returns
    Type Description
    Single

    ClampToMaxLength(Single, ref float3)

    Declaration
    public static void ClampToMaxLength(float maxLength, ref float3 vector)
    Parameters
    Type Name Description
    Single maxLength
    float3 vector

    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.

    Declaration
    public static quaternion DecomposeRigidBodyOrientation(in float4x4 localToWorld)
    Parameters
    Type Name Description
    float4x4 localToWorld
    Returns
    Type Description
    quaternion

    A world-space orientation as used by physics.

    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.

    Declaration
    public static RigidTransform DecomposeRigidBodyTransform(in float4x4 localToWorld)
    Parameters
    Type Name Description
    float4x4 localToWorld
    Returns
    Type Description
    RigidTransform

    A world-space RigidTransform as used by physics.

    Det(float3, float3, float3)

    Declaration
    public static float Det(float3 a, float3 b, float3 c)
    Parameters
    Type Name Description
    float3 a
    float3 b
    float3 c
    Returns
    Type Description
    Single

    DiagonalizeSymmetricApproximation(float3x3, out float3x3, out float3)

    Declaration
    public static void DiagonalizeSymmetricApproximation(float3x3 a, out float3x3 eigenVectors, out float3 eigenValues)
    Parameters
    Type Name Description
    float3x3 a
    float3x3 eigenVectors
    float3 eigenValues

    Dotxyz1(double4, double3)

    Declaration
    public static double Dotxyz1(double4 lhs, double3 rhs)
    Parameters
    Type Name Description
    double4 lhs
    double3 rhs
    Returns
    Type Description
    Double

    Dotxyz1(float4, float3)

    Declaration
    public static float Dotxyz1(float4 lhs, float3 rhs)
    Parameters
    Type Name Description
    float4 lhs
    float3 rhs
    Returns
    Type Description
    Single

    FromToRotation(float3, float3)

    Declaration
    public static quaternion FromToRotation(float3 from, float3 to)
    Parameters
    Type Name Description
    float3 from
    float3 to
    Returns
    Type Description
    quaternion

    HorizontalMul(float3)

    Declaration
    public static float HorizontalMul(float3 v)
    Parameters
    Type Name Description
    float3 v
    Returns
    Type Description
    Single

    HorizontalMul(float4)

    Declaration
    public static float HorizontalMul(float4 v)
    Parameters
    Type Name Description
    float4 v
    Returns
    Type Description
    Single

    IndexOfMaxComponent(float2)

    Declaration
    public static int IndexOfMaxComponent(float2 v)
    Parameters
    Type Name Description
    float2 v
    Returns
    Type Description
    Int32

    IndexOfMaxComponent(float3)

    Declaration
    public static int IndexOfMaxComponent(float3 v)
    Parameters
    Type Name Description
    float3 v
    Returns
    Type Description
    Int32

    IndexOfMaxComponent(float4)

    Declaration
    public static int IndexOfMaxComponent(float4 v)
    Parameters
    Type Name Description
    float4 v
    Returns
    Type Description
    Int32

    IndexOfMinComponent(float2)

    Declaration
    public static int IndexOfMinComponent(float2 v)
    Parameters
    Type Name Description
    float2 v
    Returns
    Type Description
    Int32

    IndexOfMinComponent(float3)

    Declaration
    public static int IndexOfMinComponent(float3 v)
    Parameters
    Type Name Description
    float3 v
    Returns
    Type Description
    Int32

    IndexOfMinComponent(float4)

    Declaration
    public static int IndexOfMinComponent(float4 v)
    Parameters
    Type Name Description
    float4 v
    Returns
    Type Description
    Int32

    Inverse(Math.MTransform)

    Declaration
    public static Math.MTransform Inverse(Math.MTransform a)
    Parameters
    Type Name Description
    Math.MTransform a
    Returns
    Type Description
    Math.MTransform

    IsNormalized(float3)

    Declaration
    public static bool IsNormalized(float3 v)
    Parameters
    Type Name Description
    float3 v
    Returns
    Type Description
    Boolean

    Mul(Math.MTransform, float3)

    Declaration
    public static float3 Mul(Math.MTransform a, float3 x)
    Parameters
    Type Name Description
    Math.MTransform a
    float3 x
    Returns
    Type Description
    float3

    Mul(Math.MTransform, Math.MTransform)

    Declaration
    public static Math.MTransform Mul(Math.MTransform cFromB, Math.MTransform bFromA)
    Parameters
    Type Name Description
    Math.MTransform cFromB
    Math.MTransform bFromA
    Returns
    Type Description
    Math.MTransform

    NextMultipleOf(Int32, Int32)

    Declaration
    public static int NextMultipleOf(int input, int alignment)
    Parameters
    Type Name Description
    Int32 input
    Int32 alignment
    Returns
    Type Description
    Int32

    NextMultipleOf(UInt64, UInt64)

    Declaration
    public static ulong NextMultipleOf(ulong input, ulong alignment)
    Parameters
    Type Name Description
    UInt64 input
    UInt64 alignment
    Returns
    Type Description
    UInt64

    NextMultipleOf16(Int32)

    Declaration
    public static int NextMultipleOf16(int input)
    Parameters
    Type Name Description
    Int32 input
    Returns
    Type Description
    Int32

    NextMultipleOf16(UInt64)

    Declaration
    public static ulong NextMultipleOf16(ulong input)
    Parameters
    Type Name Description
    UInt64 input
    Returns
    Type Description
    UInt64

    NormalizeWithLength(float3, out float3)

    Declaration
    public static float NormalizeWithLength(float3 v, out float3 n)
    Parameters
    Type Name Description
    float3 v
    float3 n
    Returns
    Type Description
    Single

    PlaneFromDirection(float3, float3)

    Declaration
    public static Plane PlaneFromDirection(float3 origin, float3 direction)
    Parameters
    Type Name Description
    float3 origin
    float3 direction
    Returns
    Type Description
    Plane

    PlaneFromTwoEdges(float3, float3, float3)

    Declaration
    public static Plane PlaneFromTwoEdges(float3 origin, float3 edgeA, float3 edgeB)
    Parameters
    Type Name Description
    float3 origin
    float3 edgeA
    float3 edgeB
    Returns
    Type Description
    Plane

    RSqrtSafe(Single)

    Declaration
    public static float RSqrtSafe(float v)
    Parameters
    Type Name Description
    Single v
    Returns
    Type Description
    Single

    TransformAabb(RigidTransform, Aabb)

    Declaration
    public static Aabb TransformAabb(RigidTransform transform, Aabb aabb)
    Parameters
    Type Name Description
    RigidTransform transform
    Aabb aabb
    Returns
    Type Description
    Aabb

    TransformAabb(Math.MTransform, Aabb)

    Declaration
    public static Aabb TransformAabb(Math.MTransform transform, Aabb aabb)
    Parameters
    Type Name Description
    Math.MTransform transform
    Aabb aabb
    Returns
    Type Description
    Aabb

    TransformPlane(RigidTransform, Plane)

    Declaration
    public static Plane TransformPlane(RigidTransform transform, Plane plane)
    Parameters
    Type Name Description
    RigidTransform transform
    Plane plane
    Returns
    Type Description
    Plane

    TransformPlane(Math.MTransform, Plane)

    Declaration
    public static Plane TransformPlane(Math.MTransform transform, Plane plane)
    Parameters
    Type Name Description
    Math.MTransform transform
    Plane plane
    Returns
    Type Description
    Plane
    In This Article
    • Methods
      • CalculatePerpendicularNormalized(float3, out float3, out float3)
      • CalculateTwistAngle(quaternion, Int32)
      • ClampToMaxLength(Single, ref float3)
      • DecomposeRigidBodyOrientation(in float4x4)
      • DecomposeRigidBodyTransform(in float4x4)
      • Det(float3, float3, float3)
      • DiagonalizeSymmetricApproximation(float3x3, out float3x3, out float3)
      • Dotxyz1(double4, double3)
      • Dotxyz1(float4, float3)
      • FromToRotation(float3, float3)
      • HorizontalMul(float3)
      • HorizontalMul(float4)
      • IndexOfMaxComponent(float2)
      • IndexOfMaxComponent(float3)
      • IndexOfMaxComponent(float4)
      • IndexOfMinComponent(float2)
      • IndexOfMinComponent(float3)
      • IndexOfMinComponent(float4)
      • Inverse(Math.MTransform)
      • IsNormalized(float3)
      • Mul(Math.MTransform, float3)
      • Mul(Math.MTransform, Math.MTransform)
      • NextMultipleOf(Int32, Int32)
      • NextMultipleOf(UInt64, UInt64)
      • NextMultipleOf16(Int32)
      • NextMultipleOf16(UInt64)
      • NormalizeWithLength(float3, out float3)
      • PlaneFromDirection(float3, float3)
      • PlaneFromTwoEdges(float3, float3, float3)
      • RSqrtSafe(Single)
      • TransformAabb(RigidTransform, Aabb)
      • TransformAabb(Math.MTransform, Aabb)
      • TransformPlane(RigidTransform, Plane)
      • TransformPlane(Math.MTransform, Plane)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023