AlphaAlphaentityThe Entity that this Component is attached to.
AlphasystemThe ComponentSystem used to create this Component.
Alpha
Sets the lower and upper limit of rotation about the joint's X axis, in degrees. For
stability, keep the limits within -180 and 180 degrees. Only used by 6dof joints when
angularMotionX is MOTION_LIMITED. Defaults to [0, 0].
Alpha
Sets the lower and upper limit of rotation about the joint's Y axis, in degrees. For
stability, keep the limits within -90 and 90 degrees. Only used by 6dof joints when
angularMotionY is MOTION_LIMITED. Defaults to [0, 0].
Alpha
Sets the lower and upper limit of rotation about the joint's Z axis, in degrees. For
stability, keep the limits within -180 and 180 degrees. Only used by 6dof joints when
angularMotionZ is MOTION_LIMITED. Defaults to [0, 0].
Alpha
Gets the type of motion allowed for rotation about the joint's X axis.
Alpha
Sets the type of motion allowed for rotation about the joint's X axis. Can be MOTION_LOCKED, MOTION_LIMITED or MOTION_FREE. Only used by 6dof joints. Defaults to MOTION_LOCKED.
Alpha
Gets the type of motion allowed for rotation about the joint's Y axis.
Alpha
Sets the type of motion allowed for rotation about the joint's Y axis. Can be MOTION_LOCKED, MOTION_LIMITED or MOTION_FREE. Only used by 6dof joints. Defaults to MOTION_LOCKED.
Alpha
Gets the type of motion allowed for rotation about the joint's Z axis.
Alpha
Sets the type of motion allowed for rotation about the joint's Z axis. Can be MOTION_LOCKED, MOTION_LIMITED or MOTION_FREE. Only used by 6dof joints. Defaults to MOTION_LOCKED.
Alpha
Gets the stiffness of the springs acting on rotation about the joint's X, Y and Z axes.
Alpha
Sets the stiffness of the springs acting on rotation about the joint's X, Y and Z axes. A
spring acts on an axis when its stiffness component is greater than 0. Only used by 6dof
joints. Defaults to [0, 0, 0] (no springs).
Alpha
Gets the impulse threshold above which the joint breaks.
Alpha
Sets the impulse threshold, in Newton seconds, above which the joint breaks. A broken joint no longer constrains its bodies, fires the 'break' event and has isBroken set to true. As a rule of thumb, a steady force breaks the joint when force × simulation timestep exceeds this value. Defaults to Infinity (unbreakable).
Alpha
Gets whether the two constrained bodies can collide with each other.
Alpha
Sets whether the two constrained bodies can collide with each other. Defaults to false.
Alpha
Gets the enabled state of the component.
Alpha
Sets the enabled state of the component.
Alpha
Gets whether the joint's limits are enabled.
Alpha
Sets whether the joint's limits are enabled. For hinge joints, this limits rotation about the joint's X axis to limits. For slider joints, this limits travel along the joint's X axis to limits. For ball joints, this limits rotation to swingLimitY, swingLimitZ and twistLimit. Not used by fixed and 6dof joints. Defaults to false.
Alpha
Sets the first entity constrained by this joint. The entity must have a RigidBodyComponent. Can be set to an Entity or the GUID of an entity. The constraint is created once both constrained entities have rigid bodies in the simulation.
Alpha
Sets the second entity constrained by this joint. The entity must have a RigidBodyComponent. Can be set to an Entity or the GUID of an entity. If null, entityA is constrained to a fixed point in world space instead. Defaults to null.
Alpha
Gets whether the joint has broken as a result of the applied impulse exceeding breakImpulse. A broken joint is re-armed by calling refreshFrames, toggling Component#enabled or changing type, entityA or entityB.
Alpha
Sets the lower and upper limit of the joint's primary degree of freedom. For hinge joints,
these are angles of rotation about the joint's X axis, in degrees; for slider joints,
distances along the joint's X axis, in meters. Only used by hinge and slider joints, when
enableLimits is true. (Ball joints limit motion with swingLimitY,
swingLimitZ and twistLimit; 6dof joints use linearLimitsX and
angularLimitsX etc.) Defaults to [-45, 45].
Alpha
Gets the rest positions of the springs acting on translation along the joint's X, Y and Z axes.
Alpha
Sets the rest positions of the springs acting on translation along the joint's X, Y and Z
axes, in meters. Only used by 6dof joints. Defaults to [0, 0, 0].
Alpha
Sets the lower and upper limit of translation along the joint's X axis, in meters. Only
used by 6dof joints when linearMotionX is MOTION_LIMITED. Defaults to
[0, 0].
Alpha
Sets the lower and upper limit of translation along the joint's Y axis, in meters. Only
used by 6dof joints when linearMotionY is MOTION_LIMITED. Defaults to
[0, 0].
Alpha
Sets the lower and upper limit of translation along the joint's Z axis, in meters. Only
used by 6dof joints when linearMotionZ is MOTION_LIMITED. Defaults to
[0, 0].
Alpha
Gets the type of motion allowed for translation along the joint's X axis.
Alpha
Sets the type of motion allowed for translation along the joint's X axis. Can be MOTION_LOCKED, MOTION_LIMITED or MOTION_FREE. Only used by 6dof joints. Defaults to MOTION_LOCKED.
Alpha
Gets the type of motion allowed for translation along the joint's Y axis.
Alpha
Sets the type of motion allowed for translation along the joint's Y axis. Can be MOTION_LOCKED, MOTION_LIMITED or MOTION_FREE. Only used by 6dof joints. Defaults to MOTION_LOCKED.
Alpha
Gets the type of motion allowed for translation along the joint's Z axis.
Alpha
Sets the type of motion allowed for translation along the joint's Z axis. Can be MOTION_LOCKED, MOTION_LIMITED or MOTION_FREE. Only used by 6dof joints. Defaults to MOTION_LOCKED.
Alpha
Gets the stiffness of the springs acting on translation along the joint's X, Y and Z axes.
Alpha
Sets the stiffness of the springs acting on translation along the joint's X, Y and Z axes.
A spring acts on an axis when its stiffness component is greater than 0. Only used by 6dof
joints. Defaults to [0, 0, 0] (no springs).
Alpha
Gets the maximum force the joint's motor can apply.
Alpha
Sets the maximum force the motor can apply to reach motorSpeed. For hinge joints, this is a torque in Newton meters; for slider joints, a force in Newtons. The motor is disabled while this is 0, so set it greater than 0 to engage the motor. Only used by hinge and slider joints. Defaults to 0.
Alpha
Gets the target speed the motor drives towards.
Alpha
Sets the target speed the motor drives towards. For hinge joints, this is an angular speed in degrees per second; for slider joints, a linear speed in meters per second. The motor is active only while maxMotorForce is greater than 0; with a target speed of 0 and a positive force the motor acts as a brake, holding the joint at rest. Only used by hinge and slider joints. Defaults to 0.
Alpha
Gets the maximum swing of a ball joint towards its Y axis.
Alpha
Sets the maximum swing of a ball joint towards its Y axis, in degrees, measured as a half-angle either side of the joint's X axis. Only used by ball joints when enableLimits is true. Defaults to 45.
Alpha
Gets the maximum swing of a ball joint towards its Z axis.
Alpha
Sets the maximum swing of a ball joint towards its Z axis, in degrees, measured as a half-angle either side of the joint's X axis. Only used by ball joints when enableLimits is true. Defaults to 45.
Alpha
Gets the maximum twist of a ball joint about its X axis.
Alpha
Sets the maximum twist of a ball joint about its X axis, in degrees, measured as a half-angle either side of the rest orientation. Only used by ball joints when enableLimits is true. Defaults to 20.
Alpha
Gets the type of joint.
Alpha
Sets the type of joint. Can be:
Defaults to JOINTTYPE_FIXED.
Alpha
Fire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optionalarg1: any
First argument that is passed to the event handler.
Optionalarg2: any
Second argument that is passed to the event handler.
Optionalarg3: any
Third argument that is passed to the event handler.
Optionalarg4: any
Fourth argument that is passed to the event handler.
Optionalarg5: any
Fifth argument that is passed to the event handler.
Optionalarg6: any
Sixth argument that is passed to the event handler.
Optionalarg7: any
Seventh argument that is passed to the event handler.
Optionalarg8: any
Eighth argument that is passed to the event handler.
Self for chaining.
Alpha
Test if there are any handlers bound to an event name.
The name of the event to test.
True if the object has handlers bound to the specified event name.
Alpha
Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event, if scope is not provided then all events with the callback will be unbound.
Use this form to remove all listeners matching a name (and optionally callback/scope). To remove a single known subscription, prefer retaining the EventHandle returned by EventHandler#on / EventHandler#once and calling its EventHandle#off: it removes exactly that subscription and is faster (no scan of the callback list).
Optionalname: string
Name of the event to unbind.
Optionalcallback: HandleEventCallback
Function to be unbound.
Optionalscope: any
Scope that was used as the this when the event is fired.
Self for chaining.
const handler = () => {};
obj.on('test', handler);
obj.off(); // Removes all events
obj.off('test'); // Removes all events called 'test'
obj.off('test', handler); // Removes all handler functions, called 'test'
obj.off('test', handler, this); // Removes all handler functions, called 'test' with scope this
Alpha
Attach an event handler to an event.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optionalscope: any = ...
Object to use as 'this' when the event is fired, defaults to current this.
An event handle. For later removal, prefer retaining this handle and calling its EventHandle#off over EventHandler#off with a name/callback: it removes exactly this subscription and is faster (no scan of the callback list).
Alpha
Alpha
Attach an event handler to an event. This handler will be removed after being fired once.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optionalscope: any = ...
Object to use as 'this' when the event is fired, defaults to current this.
An event handle. For removal before it fires, prefer retaining this handle and calling its EventHandle#off over EventHandler#off with a name/callback: it removes exactly this subscription and is faster (no scan of the callback list).
Static AlphaEVENT_Fired when the applied impulse on the joint exceeds breakImpulse and the constraint breaks. The broken joint no longer constrains its bodies and isBroken becomes true. Call refreshFrames to re-attach it. Note that on ammo builds that expose no constraint state, breakage of 6dof joints cannot be detected, so this event does not fire for them - other joint types are unaffected.
The JointComponent constrains the relative motion of two rigid bodies. The entity holding the joint component is not itself constrained - instead, its world transform defines the joint frame: the anchor point and axes that the constraint operates about. The constrained bodies are assigned via entityA and entityB, both of which must have a RigidBodyComponent. If entityB is null, entityA is constrained to a fixed point in world space.
A joint's primary axis is the joint entity's local X axis: a hinge rotates about X, a slider translates along X and a ball joint twists about X. To aim a joint, rotate the joint entity. A common pattern is to parent the joint entity to entityA at the pivot point. For 6dof joints, each degree of freedom measures the offset of entityB (or of the world anchor when entityB is null) relative to entityA, along the joint's axes.
The joint frames are captured when the underlying constraint is created - typically when the component is enabled and both bodies are present in the physics simulation. Moving the joint entity afterwards has no effect on an existing constraint. Call refreshFrames to re-capture the frames from the current world transforms. Entity scale is ignored, matching the behavior of rigid bodies.
Many properties apply only to specific joint types; each one documents the types it affects, and properties without such a note (for example entityA, enableCollision and breakImpulse) apply to all types.
To add a JointComponent to an Entity, use Entity#addComponent: