Properties
AlignType
|
The constraint’s axis alignment type (parallel or perpendicular). |
CFrame
|
The goal orientation of the |
float
|
The maximum angular velocity the constraint can use to reach its goal. |
float
|
The maximum torque the constraint can use to reach its goal. |
OrientationAlignmentMode
|
The way the constraint determines its goal orientation. |
Vector3
|
The direction of the goal’s X-Axis, represented as a unit |
bool
|
If true, the |
bool
|
When true the constraint will apply torque on both Attachments to achieve the goal. |
float
|
Controls how quickly the constraint will reach its goal. Higher values will cause the attachment to align quicker. Value can be between 5 and 200. |
bool
|
When true, the solver reacts as quickly as possible to complete the alignment. When false, the torque is dependent on |
Vector3
|
The direction of the goal’s Y-Axis, represented as a unit |
Inherited from Constraint: Show
bool
[ReadOnly]
[NotReplicated]
|
Indicates if the constraint is currently active in the world |
Attachment
|
The |
Attachment
|
The |
BrickColor
|
The color of the constraint. |
bool
|
Toggles whether or not this Constraint is enabled. |
bool
|
Toggles the visibility of this Constraint. |
bool
|
Determines if an |
string
[ReadOnly]
[NotReplicated]
|
A read-only string representing the class this |
int
[Hidden]
[ReadOnly]
[NotReplicated]
[Deprecated]
|
The cost of saving the instance using data persistence. |
string
|
A non-unique identifier of the |
Instance
[NotReplicated]
|
Determines the hierarchical parent of the |
bool
[Hidden]
|
A deprecated property that used to protect |
int64
[Hidden]
[NotReplicated]
|
bool
[Hidden]
[NotReplicated]
[Deprecated]
|
string
[ReadOnly]
[NotReplicated]
[Deprecated]
|
Functions
void
|
This function destroys all of an |
Instance
|
Create a copy of an object and all its descendants, ignoring objects that are not |
void
|
Sets the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first descendant found with the given |
Actor
|
Returns the Actor associated with the Instance, usually the first Actor ancestor |
Variant
|
Returns the attribute which has been assigned to the given name |
RBXScriptSignal
|
Returns an event that fires when the given attribute changes |
Dictionary
|
Returns a dictionary of string → variant pairs for each of the |
Objects
|
Returns an array containing all of the |
string
[NotBrowsable]
|
Returns a coded string of the |
Array
[CustomLuaState]
|
Returns an array containing all of the descendants of the instance |
string
|
Returns a string describing the |
RBXScriptSignal
|
Get an event that fires when a given property of an object changes. |
bool
[CustomLuaState]
|
Returns true if an |
bool
|
Returns true if an |
bool
|
Returns true if an |
void
[Deprecated]
|
Sets the object’s Parent to nil, and does the same for all its descendants. |
void
|
Sets the attribute with the given name to the given value |
Instance
[CustomLuaState]
[CanYield]
|
Returns the child of the |
Objects
[Deprecated]
|
Returns an array of the object’s children. |
Instance
[Deprecated]
|
void
[Deprecated]
|
Instance
[Deprecated]
|
Objects
[Deprecated]
|
bool
[Deprecated]
[CustomLuaState]
|
bool
[Deprecated]
|
void
[Deprecated]
|
Events
RBXScriptSignal
|
Fires when the |
RBXScriptSignal
|
Fires whenever an attribute is changed on the |
RBXScriptSignal
|
Fired immediately after a property of an object changes. |
RBXScriptSignal
|
Fires after an object is parented to this |
RBXScriptSignal
|
Fires after a child is removed from this |
RBXScriptSignal
|
Fires after a descendant is added to the |
RBXScriptSignal
|
Fires immediately before a descendant of the |
RBXScriptSignal
|
Fires immediately before the instance is destroyed via |
RBXScriptSignal
[Deprecated]
|
Code Samples
Creating an AlignOrientation
This example demos the functionality of AlignOrientation.
In order to do this, we must first create two BasePart
s, one with the AlignOrientation, and the other being that part that will move according to the torque applied by the AlignOrientation in the first part. Note that the part that we apply torque on, named part2, cannot be anchored or it will not move when the torque is applied.
Then, we create two attachments, attachment0 and attachment1. The first of these attachments, attachment0 will apply torque to its parent part, part1 to allign with attachment1, which is parented to part2.
For these attachments to work as described, we create a new AlignOrientation and parent it to part1. We then connect attachment0 to AlignOrientation/Attachment0
and attachment1 to AlignOrientation/Attachment1
. In this example, we set AlignOrientation/RigidityEnabled
to true because it helps to smooth the alignment - but this is optional.
Finally, to demo the alignment the example relies on RunService
’s RunService/RenderStepped
to slowly rotate part1. Due to the AlignmentOrientation, part2 also rotates as attachment0 aligns itself with attachment1.