CRITICAL: Double gravity applied to player ship each frame #3

Closed
opened 2026-05-11 06:16:42 +00:00 by Mark · 0 comments
Owner

Description

Both Ship.update() and PhysicsEngine.update() apply gravitational forces to the player ship each frame, resulting in double gravity.

Root cause

In main.js:

  • Line 262: this.playerShip.update(dt, wells, sl) -- Ship.update() lines 115-124 apply gravity from wells to velocity
  • Line 267: this.physics?.update(this.playerShip, ...) -- PhysicsEngine.update() lines 222-227 ALSO apply gravity from wells to velocity

Impact

Ships experience approximately 2x expected gravitational pull, making orbits unstable and gameplay feel wrong.

Fix

Remove gravity integration from one of the two methods. Ship.update() should handle ship-internal physics (thrust, RCS, resources) while PhysicsEngine.update() handles external forces (gravity, collisions). Or vice-versa.

## Description Both `Ship.update()` and `PhysicsEngine.update()` apply gravitational forces to the player ship each frame, resulting in double gravity. ## Root cause In `main.js`: - Line 262: `this.playerShip.update(dt, wells, sl)` -- Ship.update() lines 115-124 apply gravity from wells to velocity - Line 267: `this.physics?.update(this.playerShip, ...)` -- PhysicsEngine.update() lines 222-227 ALSO apply gravity from wells to velocity ## Impact Ships experience approximately 2x expected gravitational pull, making orbits unstable and gameplay feel wrong. ## Fix Remove gravity integration from one of the two methods. Ship.update() should handle ship-internal physics (thrust, RCS, resources) while PhysicsEngine.update() handles external forces (gravity, collisions). Or vice-versa.
Mark closed this issue 2026-05-11 16:00:20 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/gravity-racer#3
No description provided.