feat: sdk physics impulse and force#7044
Conversation
…physics-impulse # Conflicts: # Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationFlowStateMachine/ProfileFetchingAuthState.cs
|
Windows and Mac build successful in Unity Cloud! You can find a link to the downloadable artifact below. |
…eat/sdk/physics-impulse
345e243 to
21b3223
Compare
|
QA passed ✅ Scene: Single player works ok for Windows and Mac ✅ Multiplayer: As for this issue #7290, it's related to 7275, both in steps to repro and workaround, so I closed it to keep all discussions in 7275. Multiplayer: multiplayer.windows.mp4multiplayer.mac.mp4Workaround: 16.03.2026_10.35.17_REC.workaround.mp4Conclusion: everything functions as expected in both single and multiplayer modes, except for the tunnel force-up and force-forward. Although there is a workaround, it's difficult for users to figure out how to unblock themselves. It's been decided to leave the issue as known and communicate this to the creators. Single Player windows: PR-7044.single.player.mp4Single Player Mac: 16.03.2026_10.05.12_REC.PR-7044.single.player.mac.mp4Double Jump + Gliding was tested and works as expected, evidence here. |
c573891 to
d6f5299
Compare
# Pull Request Description ## What does this PR change? When the player is pushed by scene physics (e.g. a wind turbine using `avatarPhysicsSettings` / `applyForce`) while gliding, the push was very subtle and its direction was distorted compared to being pushed without the glider — while one would expect an open glider to be *more* responsive to wind, not less. Cause: `ApplyGliding` clamped the magnitude of the **whole** `GravityVelocity` vector to `GlideMaxGravity` (1 m/s) every physics tick. The clamp predates SDK external forces (#7044), which route the vertical part of a force into `GravityVelocity` via effective gravity — so while gliding the clamp silently erased all wind lift. The horizontal part of the force goes through `ExternalVelocity` and passed untouched, which is why the push direction bent towards the horizontal. Changes: - `ApplyGliding`: clamp only the fall speed (`GravityVelocity.y = Max(y, -GlideMaxGravity)`) instead of the whole vector magnitude — upward velocity from external forces and jump momentum is preserved. - `ApplyExternalForce`: while gliding, the acceleration computed from `ExternalForce` is multiplied by the new `GlideWindResponse` setting (default **1.5**, tunable in `CharacterControllerSettings`) — an open glider catches the airflow with a larger effective area. One-shot impulses (`applyImpulse`) are intentionally unaffected. - Unit tests: `ApplyGlidingShould` (fall speed clamped, upward velocity preserved), `ApplyExternalForceShould` (multiplier applied only while gliding). ## Test Instructions **Steps (standard run)**: ```bash metaforge explorer run 9317 ``` **Expected result**: in a scene with a continuous-force zone (wind turbine / fan pushing at an angle), flying into it while gliding pushes the player **stronger** than without the glider (1.5× by default) and **along the force direction**, with a clear vertical lift instead of a mostly horizontal drift. ### Test Steps 1. Go to flutterecho.dcl.eth 2. Walk/jump into the force zone without the glider — note the push strength and direction. 3. Double jump and hold jump to open the glider, fly into the same zone. 4. Expected: the push is now stronger than in step 2 and follows the force direction (noticeable lift for angled/vertical forces). 5. Verify jump pads and impulse-based pushes (`applyImpulse`) behave exactly as before, with and without the glider. 6. Verify regular gliding is unchanged: descent still capped, opening/closing/cooldown feel the same.
Pull Request Description
protocol PR
js-toolchain PR
sdk-test-scene PR
this PR implements Explorer part of Impulse/Force applied by the SDK scene
ref how-to wiki
What does this PR change?
Test Instructions
QA epic
sdk-test-scene PR
to test this feature go to
flutterecho.dcl.ethwhere there are different zones for applying force/impulseAdditional Testing Notes
Quality Checklist
Code Review Reference
Please review our Code Review Standards before submitting.