Skip to content

eulerjs API / @eulerjs/core / TargetJoint

TargetJoint ​

Defined in: packages/core/src/joints/presets.ts:167

Pulls a body toward a pose in the world, as a spring and damper with limits: for dragging a body with the mouse, carrying it, or leading an active ragdoll along by its hips. Move the target with setTarget as often as you like. It pulls as hard as a spring of its frequency on the body's mass, so a body it holds up sags by g / (2π frequency)²; take away its gravity (gravityScale = 0) to have it hold the pose exactly.

Extends ​

Constructors ​

Constructor ​

ts
new TargetJoint(options): TargetJoint;

Defined in: packages/core/src/joints/presets.ts:170

Parameters ​

ParameterType
optionsTargetJointOptions

Returns ​

TargetJoint

Overrides ​

SixDofJoint.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
angularreadonlySixAxes<AxisMotion>undefined-SixDofJoint.angularpackages/core/src/joints/SixDofJoint.ts:118
angularDrivesreadonlySixAxes<JointDrive | undefined>undefined-SixDofJoint.angularDrivespackages/core/src/joints/SixDofJoint.ts:120
bodyAreadonlyBodyundefined-SixDofJoint.bodyApackages/core/src/joints/BaseJoint.ts:23
bodyBreadonlyBody | undefinedundefined-SixDofJoint.bodyBpackages/core/src/joints/BaseJoint.ts:24
breakForcepublicnumberundefined-SixDofJoint.breakForcepackages/core/src/joints/BaseJoint.ts:32
breakTorquepublicnumberundefined-SixDofJoint.breakTorquepackages/core/src/joints/BaseJoint.ts:33
brokenpublicbooleanfalseSet once the joint has broken.SixDofJoint.brokenpackages/core/src/joints/BaseJoint.ts:42
collideConnectedSettingreadonlyboolean | "unlessOverlapping"undefinedAs asked for, before a world decides 'unlessOverlapping'.SixDofJoint.collideConnectedSettingpackages/core/src/joints/BaseJoint.ts:30
forcereadonlyVector3...The force the joint put on body B over the last step (on body A, for a joint to the world), in N, world space; on the other it is the opposite. Written by the backend.SixDofJoint.forcepackages/core/src/joints/BaseJoint.ts:38
frameAreadonlyJointFrameundefined-SixDofJoint.frameApackages/core/src/joints/SixDofJoint.ts:115
frameBreadonlyJointFrameundefined-SixDofJoint.frameBpackages/core/src/joints/SixDofJoint.ts:116
frictionpublicnumberundefined-SixDofJoint.frictionpackages/core/src/joints/SixDofJoint.ts:122
linearreadonlySixAxes<AxisMotion>undefined-SixDofJoint.linearpackages/core/src/joints/SixDofJoint.ts:117
linearDrivesreadonlySixAxes<JointDrive | undefined>undefined-SixDofJoint.linearDrivespackages/core/src/joints/SixDofJoint.ts:119
linearFrictionpublicnumberundefined-SixDofJoint.linearFrictionpackages/core/src/joints/SixDofJoint.ts:123
orientationDrivepublicOrientationDrive | undefinedundefined-SixDofJoint.orientationDrivepackages/core/src/joints/SixDofJoint.ts:121
torquereadonlyVector3...The torque the joint put on the same body over the last step, in N·m. Written by the backend.SixDofJoint.torquepackages/core/src/joints/BaseJoint.ts:40

Accessors ​

bodies ​

Get Signature ​

ts
get bodies(): readonly Body[];

Defined in: packages/core/src/joints/BaseJoint.ts:59

The bodies the joint ties together.

Returns ​

readonly Body[]

Inherited from ​

SixDofJoint.bodies


collideConnected ​

Get Signature ​

ts
get collideConnected(): boolean;

Defined in: packages/core/src/joints/BaseJoint.ts:26

Whether the two bodies collide with each other; fixed once the joint is in a world.

Returns ​

boolean

Inherited from ​

SixDofJoint.collideConnected


frequency ​

Get Signature ​

ts
get frequency(): number;

Defined in: packages/core/src/joints/presets.ts:200

How fast it springs to the target, in Hz; 0 lets the body go.

Returns ​

number

Set Signature ​

ts
set frequency(frequency): void;

Defined in: packages/core/src/joints/presets.ts:204

Parameters ​
ParameterType
frequencynumber
Returns ​

void


isOverloaded ​

Get Signature ​

ts
get isOverloaded(): boolean;

Defined in: packages/core/src/joints/BaseJoint.ts:64

Whether the loads of the last step are more than the joint can take.

Returns ​

boolean

Inherited from ​

SixDofJoint.isOverloaded


roles ​

Get Signature ​

ts
get roles(): object;

Defined in: packages/core/src/joints/SixDofJoint.ts:153

The joint's base frame and the frame that moves against it: frame A on body A and frame B on body B; or, for a joint to the world, the world's frame (frameB) and body A's (frameA), so that either way what is measured is how the second body moves.

Returns ​

object

NameTypeDefined in
baseJointFramepackages/core/src/joints/SixDofJoint.ts:153
baseBodyBody | undefinedpackages/core/src/joints/SixDofJoint.ts:153
movingJointFramepackages/core/src/joints/SixDofJoint.ts:153
movingBodyBodypackages/core/src/joints/SixDofJoint.ts:153

Inherited from ​

SixDofJoint.roles


target ​

Get Signature ​

ts
get target(): JointFrame;

Defined in: packages/core/src/joints/presets.ts:195

Where the anchor is pulled to and how the body is turned, in world space.

Returns ​

JointFrame

Methods ​

measure() ​

ts
measure(): JointMeasurement;

Defined in: packages/core/src/joints/SixDofJoint.ts:160

Where the moving frame is relative to the base frame (see roles), as the bodies are now.

Returns ​

JointMeasurement

Inherited from ​

SixDofJoint.measure


setTarget() ​

ts
setTarget(
   position, 
   quaternion?, 
   velocity?
): void;

Defined in: packages/core/src/joints/presets.ts:213

Moves the target: where to pull the anchor to, how to turn the body, and how fast the target itself is moving, which the body is pulled to match so that it keeps up instead of lagging.

Parameters ​

ParameterType
positionVector3
quaternion?Quaternion
velocity?Vector3

Returns ​

void

Released under the MIT License.