Skip to content

Feat/physics world improvement#5

Merged
Satvik-Singh192 merged 1 commit into
devfrom
feat/PhysicsWorldImprovement
Mar 3, 2026
Merged

Feat/physics world improvement#5
Satvik-Singh192 merged 1 commit into
devfrom
feat/PhysicsWorldImprovement

Conversation

@Satvik-Singh192
Copy link
Copy Markdown
Owner

Description

Refactored the Rigidbody implementation and introduced a proper PhysicsWorld class.
Moved integration logic from bodies into the world to keep architecture clean and layered.

This sets up the base structure for gravity and future collision handling.

Changes Made

  • Removed self-update logic from Rigidbody
  • Added force accumulation system inside Rigidbody
  • Introduced PhysicsWorld class to manage bodies
  • Centralized gravity and integration inside PhysicsWorld::step
  • Cleaned separation between main loop and engine logic

Implementation Details

  • Rigidbody now only stores physical state (position, velocity, inverse mass, force accumulator).
  • PhysicsWorld owns all bodies and handles integration per timestep.
  • Gravity is applied as a force inside the world step.
  • main.cpp only handles fixed timestep and calls world.step(dt).

Checklist

Type:

  • Bug Fix
  • Feature
  • Chore

@Satvik-Singh192 Satvik-Singh192 changed the base branch from main to dev March 3, 2026 17:23
@Satvik-Singh192 Satvik-Singh192 merged commit 95c48d3 into dev Mar 3, 2026
1 check passed
@Satvik-Singh192 Satvik-Singh192 deleted the feat/PhysicsWorldImprovement branch March 3, 2026 17:24
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.

1 participant