{!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} Struct Constraint | Unity Physics | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct Constraint

    A linear or angular constraint in 1, 2, or 3 dimensions.

    Implements
    IEquatable<Constraint>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Physics
    Assembly: solution.dll
    Syntax
    public struct Constraint : IEquatable<Constraint>

    Fields

    Name Description
    ConstrainedAxes

    The constrained axes.

    DampingRatio

    The damping ratio.

    DefaultDampingRatio

    The default damping ratio.

    DefaultMaxImpulse

    The default maximum impulse.

    DefaultSpringDamping

    Deprecated. Use DefaultDampingRatio instead.

    The default damping ratio.
    DefaultSpringFrequency

    The default spring frequency.

    (Immutable) Current default values give tau = 0.6 damping = 0.99 at 60hz The values are huge and we can't get damping = 1 -- a stiff constraint is the limit of a damped spring as spring params go to infinity. Rather than baking them these values could be calculated using JacobianUtilities.CalculateSpringFrequencyAndDamping(0.6f, 0.99f, math.rcp(60.0f), 4, out DefaultSpringFrequency, out DefaultDampingRatio);

    Max

    The maximum.

    MaxImpulse

    The impulse threshold after which ImpulseEvent will be raised from this constraint. In case of motorized constraints, represents the maximum impulse that can be applied to it during one step.

    Min

    The minimum.

    SpringDamping

    Deprecated. Use DampingRatio instead.

    The spring damping ratio.
    SpringFrequency

    The spring frequency.

    Target

    The target a motor will drive towards. Can be set to zero for non-motor type constraints

    Type

    The constraint type.

    Properties

    Name Description
    ConstrainedAxis1D

    Selects the constrained axis from a constraint with Dimension == 1

    Dimension

    Number of affected degrees of freedom. 1, 2, or 3.

    FreeAxis2D

    Selects the free axis from a constraint with Dimension == 2

    Methods

    Name Description
    AngularVelocityMotor(float, float, float, float)

    Drives bodies to a specified target angular velocity, around one axis.

    BallAndSocket(float, float)

    Constrains linear motion about all three axes to zero.

    BallAndSocket(float3, float, float)

    Constrains linear motion about all three axes to zero.

    Cone(int, FloatRange, float, float)

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

    Cone(int, FloatRange, float3, float, float)

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

    Cylindrical(int, FloatRange, float, float)

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

    Cylindrical(int, FloatRange, float3, float, float)

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

    Equals(object)

    Tests if this object is considered equal to another.

    Equals(Constraint)

    Tests if this Constraint is considered equal to another.

    FixedAngle(float, float)

    Constrains angular motion about all three axes to zero.

    FixedAngle(float3, float, float)

    Constrains angular motion about all three axes to zero.

    GetHashCode()

    Calculates a hash code for this object.

    Hinge(int, float, float)

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

    Hinge(int, float3, float, float)

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

    LimitedDistance(FloatRange, float, float)

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

    LimitedDistance(FloatRange, float3, float, float)

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

    LinearVelocityMotor(float, float, float, float)

    Drives bodies to a specified target relative velocity, along one axis.

    MotorPlanar(float, float, float, float)

    Moves bodies along one axis to specified target distance. Movement about the other two perpendicular axes is unrestricted.

    MotorTwist(float, float, float, float)

    Constrains angular motion about one axis and drives towards the specified target rotation.

    Planar(int, FloatRange, float, float)

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

    Planar(int, FloatRange, float3, float, float)

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

    Twist(int, FloatRange, float, float)

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

    Twist(int, FloatRange, float3, float, float)

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

    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)