docs.unity3d.com
    Show / Hide Table of Contents

    Struct Constraint

    Namespace: Unity.Physics
    Syntax
    public struct Constraint : IEquatable<Constraint>

    Fields

    ConstrainedAxes

    Declaration
    public bool3 ConstrainedAxes
    Field Value
    Type Description
    bool3

    DefaultSpringDamping

    Declaration
    public const float DefaultSpringDamping = null
    Field Value
    Type Description
    Single

    DefaultSpringFrequency

    Declaration
    public const float DefaultSpringFrequency = null
    Field Value
    Type Description
    Single

    Max

    Declaration
    public float Max
    Field Value
    Type Description
    Single

    Min

    Declaration
    public float Min
    Field Value
    Type Description
    Single

    SpringDamping

    Declaration
    public float SpringDamping
    Field Value
    Type Description
    Single

    SpringFrequency

    Declaration
    public float SpringFrequency
    Field Value
    Type Description
    Single

    Type

    Declaration
    public ConstraintType Type
    Field Value
    Type Description
    ConstraintType

    Methods

    BallAndSocket(Single, Single)

    Constrains linear motion about all three axes to zero.

    Declaration
    public static Constraint BallAndSocket(float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    Cone(Int32, Math.FloatRange, Single, Single)

    Constrains angular motion about two axes within the specified range. Rotation around the third is unrestricted.

    Declaration
    public static Constraint Cone(int freeAxis, Math.FloatRange angularRange, float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Int32 freeAxis

    The axis specifying the height of the cone within which the bodies may rotate.

    Math.FloatRange angularRange

    The minimum required angle and maximum possible angle between the free axis and its bind pose orientation. A minimum value of zero produces a conical range of motion, while a minimum value greater than zero results in motion restricted to the intersection of the inner and outer cones.

    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    Cylindrical(Int32, Math.FloatRange, Single, Single)

    Constrains linear motion about two axes within the specified range. Movement about the third is unrestricted.

    Declaration
    public static Constraint Cylindrical(int freeAxis, Math.FloatRange distanceRange, float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Int32 freeAxis

    The axis along which the bodies may freely translate.

    Math.FloatRange distanceRange

    The minimum required distance and maximum possible distance between the constrained bodies about the two constrained axes. A minimum value of zero produces a cylindrical range of motion, while a minimum value greater than zero results in a tube-shaped range of motion.

    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj
    Returns
    Type Description
    Boolean

    Equals(Constraint)

    Declaration
    public bool Equals(Constraint other)
    Parameters
    Type Name Description
    Constraint other
    Returns
    Type Description
    Boolean

    FixedAngle(Single, Single)

    Constrains angular motion about all three axes to zero.

    Declaration
    public static Constraint FixedAngle(float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    Hinge(Int32, Single, Single)

    Constrains angular motion about two axes to zero. Rotation around the third is unrestricted.

    Declaration
    public static Constraint Hinge(int freeAxis, float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Int32 freeAxis

    The axis around which the bodies may freely rotate.

    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    LimitedDistance(Math.FloatRange, Single, Single)

    Constrains linear motion about all three axes within the specified range.

    Declaration
    public static Constraint LimitedDistance(Math.FloatRange distanceRange, float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Math.FloatRange distanceRange

    The minimum required distance and maximum possible distance between the constrained bodies.

    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    Planar(Int32, Math.FloatRange, Single, Single)

    Constrains linear motion about one axis within the specified range. Movement about the other two is unrestricted.

    Declaration
    public static Constraint Planar(int limitedAxis, Math.FloatRange distanceRange, float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Int32 limitedAxis

    The axis along which the bodies' translation is restricted.

    Math.FloatRange distanceRange

    The minimum required distance and maximum possible distance between the constrained bodies about the constrained axis. Identical minimum and maximum values result in a plane, while different values constrain the bodies between two parallel planes.

    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint

    Twist(Int32, Math.FloatRange, Single, Single)

    Constrains angular motion about about one axis within the specified range.

    Declaration
    public static Constraint Twist(int limitedAxis, Math.FloatRange angularRange, float springFrequency = null, float springDamping = null)
    Parameters
    Type Name Description
    Int32 limitedAxis

    The axis around which the bodies' rotation is restricted.

    Math.FloatRange angularRange

    The minimum required angle and maximum possible angle of rotation between the constrained bodies around the constrained axis.

    Single springFrequency
    Single springDamping
    Returns
    Type Description
    Constraint
    In This Article
    • Fields
      • ConstrainedAxes
      • DefaultSpringDamping
      • DefaultSpringFrequency
      • Max
      • Min
      • SpringDamping
      • SpringFrequency
      • Type
    • Methods
      • BallAndSocket(Single, Single)
      • Cone(Int32, Math.FloatRange, Single, Single)
      • Cylindrical(Int32, Math.FloatRange, Single, Single)
      • Equals(Object)
      • Equals(Constraint)
      • FixedAngle(Single, Single)
      • GetHashCode()
      • Hinge(Int32, Single, Single)
      • LimitedDistance(Math.FloatRange, Single, Single)
      • Planar(Int32, Math.FloatRange, Single, Single)
      • Twist(Int32, Math.FloatRange, Single, Single)
    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