physics2d
10 public commands in this category.
apply_force2d
Apply force to a 2D physics body
Scope:
scene:write. Token cost: 0.- entityId string (required)
- Target entity ID
- force array (required)
- [x, y] force vector
- point array (optional)
- [x, y] world-space application point (defaults to center of mass)
apply_impulse2d
Apply instant impulse to a 2D physics body
Scope:
scene:write. Token cost: 0.- entityId string (required)
- Target entity ID
- impulse array (required)
- [x, y] impulse vector
- point array (optional)
- [x, y] world-space application point (defaults to center of mass)
get_joint_2d
Query the 2D joint attached to an entity
Scope:
scene:read. Token cost: 0.- entityId string (required)
- Entity ID whose 2D joint to read
get_physics2d
Query 2D physics data for an entity. Applied in both the editor and exported (runtime) games (#9550).
Scope:
scene:read. Token cost: 0.- entityId string (required)
- Target entity ID
list_joints_2d
List every 2D joint in the scene
Scope:
scene:read. Token cost: 0.raycast2d
Cast a ray in the 2D physics world
Scope:
scene:read. Token cost: 0.- directionX number (required)
- Ray direction X
- directionY number (required)
- Ray direction Y
- originX number (required)
- Ray start X
- originY number (required)
- Ray start Y
- maxDistance number (optional)
- Max ray distance
remove_physics2d
Remove 2D physics from an entity
Scope:
scene:write. Token cost: 0.- entityId string (required)
- Target entity ID
set_debug_physics2d
Toggle 2D physics debug rendering. Applied in both the editor and exported (runtime) games (#9550).
Scope:
scene:write. Token cost: 0.- enabled boolean (required)
- Show collider wireframes
set_gravity2d
Set global 2D gravity. Applied in both the editor and exported (runtime) games (#9550).
Scope:
scene:write. Token cost: 0.- x number (optional)
- Horizontal gravity (default 0)
- y number (optional)
- Vertical gravity, negative = downward (default -9.81)
set_physics2d
Configure 2D physics on an entity
Scope:
scene:write. Token cost: 0.- entityId string (required)
- Target entity ID
- bodyType string (optional)
- Physics body type
- colliderShape string (optional)
- Collider shape
- continuousDetection boolean (optional)
- CCD for fast objects
- friction number (optional)
- Surface friction (0-2)
- gravityScale number (optional)
- Gravity multiplier
- isSensor boolean (optional)
- Trigger volume (no collision response)
- lockRotation boolean (optional)
- Prevent rotation
- mass number (optional)
- Mass (dynamic bodies only)
- oneWayPlatform boolean (optional)
- Only collide from above (static only)
- radius number (optional)
- Radius for circle/capsule
- restitution number (optional)
- Bounciness (0-1)
- size array (optional)
- Width and height [w, h]
- surfaceVelocity array (optional)
- Constant surface velocity [x, y] for conveyor-belt-style one-way platforms
- vertices array (optional)
- Polygon vertices [[x, y], ...] for the convex_polygon collider shape