Download presentation
Presentation is loading. Please wait.
1
Introduction to Game Physics
1
2
Game Physics Not trying to build a perfect physical model
Most things can be approximated assuming Newtonian physics and rigid bodies Use discrete simulation (constant step) techniques
3
Why Physics The Human Experience
Real-world motions are physically-based Physics can make simulated game worlds appear more natural Makes sense to strive for physically-realistic motion for some types of games Emergent Behavior Physics simulation can enable a richer gaming experience
4
Physics of Motion Terms
Position The vector indicating the location of a point relative to the coordinate system’s origin Velocity The rate of change of the position of an object Acceleration The rate at which the velocity of an object changes with time
5
Position and Velocity Where is the object at time t (using pixels)?
Computation position(t) += velocity * dt Where dt is the amount of time passed since the last Update (either calculated programmatically or via GameTime)
6
Acceleration Where is the objects rate of change (using pixels)?
Computation velocity += acceleration * dt Where dt is the amount of time passed since the last Update (either calculated programmatically or via GameTime)
7
Friction and Damping With no acceleration, velocity will only change based upon user input To slow objects down without acceleration * after updating position Computation velocity *= rateOfDecay Where 0.0 < rateOfDecay < 1.0
8
Clamping Keeping a value within a specified range Computation
Prevent the object(s) from traveling off-screen Prevent the object(s) from moving too fast Computation float value = MathHelper.Clamp ( valueToClamp, minimumValue, maximumValue);
9
Other Physics Issues User control for jumping height
Input tracking Sequence on keys/buttons\controller’s currentState and previousState State driven JumpingState (velocity can continue to decrease) FallingState (velocity can only decrease) Stuck on ground plane Ground Plane (y > upperLimit could trigger player Death) Grounded state doesn’t apply gravity but can transition to falling/jumping
10
Simple 2D Physics By Example
Demonstration
11
?
12
References Maxim, Bruce R. Computer Game Physics
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.