A physics constraint that ensures two axes on two rigid bodies remain perpendicular. An example use of this constraint are power transmission between the transmission and rear drive shafts of rear-wheel drive cars, robotics, etc.
The constraint ensures that two attachments are co-located (similar to BallSocketConstraint) and that their secondary axes remain perpendicular (see the picture below). In this sense, this constraint is more restrictive than the BallSocketConstraint but is less restrictive than HingeConstraint (by one degree of freedom).
If LimitsEnabled is true, then the relative motion of the primary axis of Attachment1 is limited by a cone. This cone is formed via Attachment0 and its primary axis and makes an angle of MaxAngle with it.
local BodyA = Instance.new("Part")BodyA.Size = Vector3.new(1, 1, 1)BodyA.Position = Vector3.new(2, 10, 1)BodyA.CanCollide = falseBodyA.Anchored = trueBodyA.Parent = workspacelocal BodyB = Instance.new("Part")BodyB.Size = Vector3.new(1, 1, 1)BodyB.Position = Vector3.new(-2, 10, 1)BodyB.CanCollide = falseBodyB.Parent = workspacelocal attachmentA = Instance.new("Attachment")attachmentA.Position = Vector3.new(-1, 0, 0)attachmentA.Axis = Vector3.new(-1, 0, 0)attachmentA.SecondaryAxis = Vector3.new(0, 0, 1)attachmentA.Parent = BodyAlocal attachmentB = Instance.new("Attachment")attachmentB.Position = Vector3.new(1, 0, 0)attachmentB.Axis = Vector3.new(-1, 0, 0)attachmentB.SecondaryAxis = Vector3.new(0, 1, 0)attachmentB.Parent = BodyBlocal universalConstraint = Instance.new("UniversalConstraint")universalConstraint.Attachment0 = attachmentAuniversalConstraint.Attachment1 = attachmentBuniversalConstraint.Parent = BodyA
Determines whether the angular motion of attachments' primary axes is limited.
The restitution coefficient of the cone constraint.
This property, when enabled, limits the relative angular motion of the primary axes of attachments through a cone constraint. The default value is false.
The example below demonstrates how developers can enable a cone limit on the relative motion of the primary axes:
universalConstraint.LimitsEnabled = true
This property determines the max angle, in degrees, of the UniversalConstraint's limiting cone. The limiting cone is formed from Attachment0 and its primary axis. The default value is 45.0 degrees.
In order for this property to take affect, the constraint's UniversalConstraint.LimitsEnabled property must be set to true.
For example, the code snippet below sets LimitsEnabled to true and limits the UniversalConstraint.MaxAngle to 10 degrees:
universalConstraint.LimitsEnabled = trueuniversalConstraint.MaxAngle = 10
This property indicates the visualization radius, in studs, of the constraint when the constraint's details are off and the constraint is selected. The default value is 0.2 studs.
This property determines the restitution of the two limits, or how elastic they are. The value defaults to 0 and can be any floating number in the range [0, 1].
This property only applies when `Class.UniversalConstraint.LimitsEnabled` is set to true.
The elasticity affects the Attachments connected by the UniversalConstraint when they reach the end of the range specified by UniversalConstraint.MaxAngle.