Skip to content

Physics Impulses to Players #1537

Description

@rodrigo685

Summary

Implement support for physics impulses and forces applied to the player entity, as defined by the Decentraland protocol. Scenes should be able to apply one-shot impulses and continuous forces to the player character (e.g., jump pads, wind zones, explosions, conveyor belts).

Protocol Components

Two new protocol components need to be handled by the renderer:

PBPhysicsCombinedImpulse (component ID: 1215)

  • One-shot impulse applied in a single frame
  • Contains a Vector3 (direction + magnitude) and an event_id (monotonic counter)
  • Event-like: the renderer must track event_id and only process each unique ID once. Incrementing event_id triggers a new impulse even if the vector is the same
  • Defined in physics_combined_impulse.proto

PBPhysicsCombinedForce (component ID: 1216)

  • Continuous force applied every physics tick while the component is present
  • Contains a Vector3 (direction + magnitude)
  • State-like: force is applied continuously, not as a one-time event
  • Defined in physics_combined_force.proto

Implementation Notes

  • Both components are summary components: the SDK accumulates all impulses/forces from scene code and writes the combined result to the component
  • The renderer reads these components from the player entity and applies the physics accordingly
  • Impulse should be applied as an instantaneous velocity change; force should be applied per-tick as an acceleration
  • Must handle the event_id deduplication for impulses correctly (only process each ID once)

Related References

Resource Link
Protocol PR (merged) decentraland/protocol#363
JS SDK toolchain PR decentraland/js-sdk-toolchain#1338
SDK issue decentraland/sdk#273
Test scene PR decentraland/sdk7-test-scenes#49
Original RFC https://www.notion.so/decentraland/RFC-Apply-Impulse-to-Player-6563cea1471246de9c91729973eee560

Unity Renderer

No implementation was found in decentraland/unity-renderer for these components — this appears to be a new feature that has not been implemented in any renderer yet. The protocol and SDK-side work is in progress (JS SDK PR is still open).

Acceptance Criteria

  • Handle PBPhysicsCombinedImpulse component on the player entity — apply one-shot impulse with correct event_id deduplication
  • Handle PBPhysicsCombinedForce component on the player entity — apply continuous force per physics tick
  • Verify with the test scene from sdk7-test-scenes#49
  • Ensure forces/impulses respect scene boundaries (only applied while player is in the scene)

Updated by Claw 🤖 — Requested by Rodri via Slack

Metadata

Metadata

Assignees

Fields

No fields configured for Feature.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions