Struct Constraint
Syntax
public struct Constraint : IEquatable<Constraint>
Fields
ConstrainedAxes
Declaration
public bool3 ConstrainedAxes
Field Value
DefaultSpringDamping
Declaration
public const float DefaultSpringDamping = null
Field Value
DefaultSpringFrequency
Declaration
public const float DefaultSpringFrequency = null
Field Value
Max
Declaration
Field Value
Min
Declaration
Field Value
SpringDamping
Declaration
public float SpringDamping
Field Value
SpringFrequency
Declaration
public float SpringFrequency
Field Value
Type
Declaration
public ConstraintType Type
Field Value
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
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
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
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Equals(Constraint)
Declaration
public bool Equals(Constraint other)
Parameters
Returns
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
GetHashCode()
Declaration
public override int GetHashCode()
Returns
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
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
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
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
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.