AlphaAlphaentityThe Entity that this Component is attached to.
AlphasystemThe ComponentSystem used to create this Component.
AlphaSets 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].
AlphaSets 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].
AlphaSets 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].
AlphaGets the type of motion allowed for rotation about the joint's X axis.
AlphaSets 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.
AlphaGets the type of motion allowed for rotation about the joint's Y axis.
AlphaSets 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.
AlphaGets the type of motion allowed for rotation about the joint's Z axis.
AlphaSets 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.
AlphaGets the stiffness of the springs acting on rotation about the joint's X, Y and Z axes.
AlphaSets 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).
AlphaGets the impulse threshold above which the joint breaks.
AlphaSets 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).
AlphaGets whether the two constrained bodies can collide with each other.
AlphaSets whether the two constrained bodies can collide with each other. Defaults to false.
AlphaGets the enabled state of the component.
AlphaSets the enabled state of the component.
AlphaGets whether the joint's limits are enabled.
AlphaSets 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.
AlphaSets 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.
AlphaSets 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.
AlphaGets 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.
AlphaSets 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].
AlphaGets the rest positions of the springs acting on translation along the joint's X, Y and Z axes.
AlphaSets 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].
AlphaSets 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].
AlphaSets 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].
AlphaSets 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].
AlphaGets the type of motion allowed for translation along the joint's X axis.
AlphaSets 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.
AlphaGets the type of motion allowed for translation along the joint's Y axis.
AlphaSets 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.
AlphaGets the type of motion allowed for translation along the joint's Z axis.
AlphaSets 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.
AlphaGets the stiffness of the springs acting on translation along the joint's X, Y and Z axes.
AlphaSets 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).
AlphaGets the maximum force the joint's motor can apply.
AlphaSets 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.
AlphaGets the target speed the motor drives towards.
AlphaSets 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.
AlphaGets the maximum swing of a ball joint towards its Y axis.
AlphaSets 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.
AlphaGets the maximum swing of a ball joint towards its Z axis.
AlphaSets 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.
AlphaGets the maximum twist of a ball joint about its X axis.
AlphaSets 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.
AlphaGets the type of joint.
AlphaSets the type of joint. Can be:
Defaults to JOINTTYPE_FIXED.
AlphaFire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optionalarg1: anyFirst argument that is passed to the event handler.
Optionalarg2: anySecond argument that is passed to the event handler.
Optionalarg3: anyThird argument that is passed to the event handler.
Optionalarg4: anyFourth argument that is passed to the event handler.
Optionalarg5: anyFifth argument that is passed to the event handler.
Optionalarg6: anySixth argument that is passed to the event handler.
Optionalarg7: anySeventh argument that is passed to the event handler.
Optionalarg8: anyEighth argument that is passed to the event handler.
Self for chaining.
AlphaTest 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.
AlphaDetach 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.
Optionalname: stringName of the event to unbind.
Optionalcallback: HandleEventCallbackFunction to be unbound.
Optionalscope: anyScope 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
AlphaAttach 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.
Can be used for removing event in the future.
AlphaAlphaAttach 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.
Can be used for removing event in the future.
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: