The Joint component allows for a slot or object to rotate around a single point, in any direction, or around an axis. Common uses are doors, helmet tops, and dials.
The Joint component allows for a slot or object to rotate around a single point, in any direction, or around an axis. Common uses are doors, helmet tops, and dials.
== Usage ==
{{Note|Joints go in both directions, making it sometimes confusing. Giving the entire door mechanism a parent slot, rotating it max angle degrees, and then halving the max angle will fix this issue.|suggestion}}
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|EditModeOnly|Bool| User can only interact with the joint in [[Edit Mode]]
|EditModeOnly|Bool| User can only interact with the joint in [[Edit Mode]]
|AllowSteal|Bool| Controls whether other users can steal the grabbable joint from other players
|AllowSteal|Bool| Controls whether other users can steal the grabbable joint from other players
|DropOnDisable|Bool| Controls whether the user drops the joint if the object has been disabled
|DropOnDisable|Bool| Controls whether the user drops the joint if the object has been disabled
|DontDrive|Bool|
|DontDrive|Bool| Write the transforms every game tick, rather than driving it on the local machine and then sending the final value to the host.
|AllowOnlyPhysicalGrab|Bool| Only allow grabbing the joint with a physical interaction - remote grabs are not allowed
|AllowOnlyPhysicalGrab|Bool| Only allow grabbing the joint with a physical interaction - remote grabs are not allowed
|ActiveUserFilter|ActiveUserHandling|
|ActiveUserFilter|ActiveUserHandling| How to allow or deny users from interacting with this component depending on the active user.
|CustomGrabCheck|{{RootFieldType|SyncDelegate`1|[[Type:GrabCheck|GrabCheck]]}}|TypeAdv6=true| A sync delegate that controls whether this object can be grabbed in certain instances.
|_pos|{{RootFieldType|DriveRef`1|[[Type:Sync`1|Sync`1]]<[[Type:Float3|Float3]]>}}|TypeAdv9=true| The current position field this is driving or influencing.
|_rot|{{RootFieldType|DriveRef`1|[[Type:Sync`1|Sync`1]]<[[Type:FloatQ|FloatQ]]>}}|TypeAdv10=true| The current rotation field this is driving or influencing.
|_scl|{{RootFieldType|DriveRef`1|[[Type:Sync`1|Sync`1]]<[[Type:Float3|Float3]]>}}|TypeAdv11=true| The current scale field this is driving or influencing.
|__legacyActiveUserRootOnly|Bool|
|__legacyActiveUserRootOnly|Bool| Whether to use the legacy active user root only behavior.
|GrabPriority|Int| {{Template:Grab Priority}}
|GrabPriority|Int| {{Template:Grab Priority}}
|MaxSwing|Float|
|MaxSwing|Float| Maximum amount the joint will Twist during rotation.
|MaxTwist|Float| Maximum amount the joint will rotate in the given axis
|MaxTwist|Float| Maximum amount the joint will rotate in the given axis
|Axis|Float3| Determines which axis the joint rotates on. Use 1 to define the axis, 0 to ignore it
|Axis|Float3| Determines which axis the joint rotates on. Is used like a vector.
|TwistReferenceAxis|Float3|
|TwistReferenceAxis|Float3| The reference axis (vector) for twisting.
|PositionTwistThresholdAngle|Float|
|PositionTwistThresholdAngle|Float| The angle at which twist will start affecting position of the slot via position twisting.
|VibrationAngle|Float|
|VibrationAngle|Float| The angle at which to trigger vibration.
|VibrationPreset|VibratePreset|
|VibrationPreset|VibratePreset| The kind and intensity of vibration to send to the grabbing controller.
|SnapIncrement|Float|
|SnapIncrement|Float| Snap the joint to a multiple of this angle during grabbing. Can be used to simulate "detents" on a rotary switch.
|SnapTime|Float| The time it takes for the joint to lerp towards given SnapOrientations. Higher the value the slower it takes
|SnapTime|Float| The time it takes for the joint to lerp towards given <code>SnapOrientations</code>. Higher the value the slower it takes
|SnapOnRelease|Bool| Controls whether the join snaps to given SnapOrientations
|SnapOnRelease|Bool| Controls whether the join snaps to given SnapOrientations
|SnapOrientations|{{RootFieldType|SyncList`1|[[#SnapOrientation|Joint.SnapOrientation]]}}|TypeAdv24=true| A list of snap orientations that the joint can snap to.
|origRotation|FloatQ|
|origRotation|FloatQ| The resting rotation of the joint.
|rotReference|FloatQ|
|rotReference|FloatQ| The reference rotation, which is where the joint started.
|dirReference|Float3|
|dirReference|Float3| The direction the joint started.
|twistReference|Float3|
|twistReference|Float3| The position to use for twist calculations
|usePositionTwist|Bool|
|usePositionTwist|Bool| Whether twist can influence the position of the joint.
}}
}}
== Behavior ==
== Usage ==
== Examples ==
== Examples ==
* [https://www.youtube.com/watch?v=Ut2rqPmRfzo Using Joint to make A Door Pt. 1] by [[User:ProbablePrime|ProbablePrime]]
Here is a video explaining how joints work by making a door (by [[User:Stellanora|Stellanora]])
* [https://www.youtube.com/watch?v=ql6PNOHT-0s Using Joint to make a Door pt.2] by [[User:ProbablePrime|ProbablePrime]]
<youtube>aLUYB9TMxNw</youtube>
Here are some old videos by [[User:ProbablePrime|ProbablePrime]]
The Joint component allows for a slot or object to rotate around a single point, in any direction, or around an axis. Common uses are doors, helmet tops, and dials.
Joints go in both directions, making it sometimes confusing. Giving the entire door mechanism a parent slot, rotating it max angle degrees, and then halving the max angle will fix this issue.
Determines what gets grabbed if several grabbable objects are touching someone's grab sphere. The IGrabbable with the highest priority will be grabbed first. If the highest priority ties with another IGrabbable, it will grab both of those and ignore any lower priority IGrabbables.