Skip to content

feat: sdk physics impulse and force#7044

Merged
popuz merged 75 commits into
devfrom
feat/sdk/physics-impulse
Mar 16, 2026
Merged

feat: sdk physics impulse and force#7044
popuz merged 75 commits into
devfrom
feat/sdk/physics-impulse

Conversation

@popuz

@popuz popuz commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

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?

  • add component handling logic
  • extract debug from the core logic system for char velocity
  • expose new settings to the char controller

Test Instructions

QA epic
sdk-test-scene PR

to test this feature go to flutterecho.dcl.eth where there are different zones for applying force/impulse

Additional Testing Notes

  • Note any edge cases to verify
  • Mention specific areas that need careful testing
  • List known limitations or potential issues

Quality Checklist

  • Changes have been tested locally
  • Documentation has been updated (if required)
  • Performance impact has been considered
  • For SDK features: Test scene is included

Code Review Reference

Please review our Code Review Standards before submitting.

@popuz popuz self-assigned this Feb 11, 2026
@popuz popuz added the force-build Used to trigger a build on draft PR label Feb 11, 2026
@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

@popuz
popuz marked this pull request as ready for review February 13, 2026 14:11
@popuz
popuz requested a review from a team as a code owner February 13, 2026 14:11
@popuz
popuz requested a review from a team as a code owner February 13, 2026 14:11
@github-actions
github-actions Bot requested a review from anicalbano February 13, 2026 14:12

@daniele-dcl daniele-dcl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🚀

Comment thread Explorer/CharacterMotion.csproj.DotSettings
@AnsisMalins

Copy link
Copy Markdown
Contributor

@AnsisMalins

Copy link
Copy Markdown
Contributor

@popuz
popuz force-pushed the feat/sdk/physics-impulse branch from 345e243 to 21b3223 Compare March 9, 2026 18:37
@popuz popuz changed the title Feat: sdk physics impulse and force feat: sdk physics impulse and force Mar 13, 2026
@balducciv

balducciv commented Mar 16, 2026

Copy link
Copy Markdown

QA passed
Build: 4b879f4

Scene: flutterecho

Single player works ok for Windows and Mac ✅

Multiplayer: ⚠️
The issue #7275 discussed on this thread still occurs, and I was able to test that the workaround work. However it's a bit confusing for the user. In my case, I didn't know I had to go through the trigger area again to get unblocked.

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.mp4
multiplayer.mac.mp4

Workaround:

16.03.2026_10.35.17_REC.workaround.mp4

Conclusion: 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.mp4

Single Player Mac:

16.03.2026_10.05.12_REC.PR-7044.single.player.mac.mp4

Double Jump + Gliding was tested and works as expected, evidence here.

@popuz
popuz force-pushed the feat/sdk/physics-impulse branch from c573891 to d6f5299 Compare March 16, 2026 14:42
@popuz
popuz merged commit 69fbb2c into dev Mar 16, 2026
10 of 11 checks passed
@popuz
popuz deleted the feat/sdk/physics-impulse branch March 16, 2026 16:25
popuz added a commit that referenced this pull request Jul 8, 2026
# 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants