cocos_add_relative_joint2d
Attach a relative joint in Cocos Creator to maintain position and angle between physics bodies, enabling follow-target behavior for game objects.
Instructions
Attach cc.RelativeJoint2D — keeps relative position+angle ('attach to' effect).
Also covers the follow-target use case that the old cocos_add_motor_joint2d
tried to solve; cc.MotorJoint2D does not exist in Cocos 3.8.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>",
"node_id": "<node_id>"
},
"name": "cocos_add_relative_joint2d"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| connected_body_id | No | ||
| max_force | No | ||
| max_torque | No | ||
| correction_factor | No | ||
| auto_calc_offset | No | ||
| linear_offset_x | No | ||
| linear_offset_y | No | ||
| angular_offset | No | ||
| collide_connected | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |