struct Rigidbody { Vector2 force = { 0, 0 }; Vector2 velocity = { 0, 0 }; Vector2 position = { 0, 0 }; float32 mass = 1.f; void update(float32 deltaTimeSeconds) { applyGravity(deltaTimeSeconds); Vector2 acceleration = force / mass; velocity += (acceleration * deltaTimeSeconds); position += (velocity * deltaTimeSeconds); force = Vector2 { 0.f, 0.f }; } void applyGravity(float32 deltaTimeSeconds) { velocity += (Vector2 { 0.f, -9.8.f } * deltaTimeSeconds); } void applyForce(Vector2 f) { force += f; } };