Video game physics are what make virtual worlds like video games feel real. Applying physics rules to virtual objects allows them to behave like physical objects, effectively bringing these virtual worlds to life. Game physics give virtual objects movement and interaction to create a fully immersive experience for users.
Physical objects in physical spaces behave in a certain way. They fall to the ground, knock against one another, move, come to a stop. All objects are governed by “physics.”
Well, if we want our virtual objects to behave like physical objects, then the game engine can apply physics rules to the movement and interactions of the virtual objects. For example, we can turn on gravity and let the objects fall. We can have projectiles launched in a direction. We can have objects bounce, strike one another and knock each other over. All of these are possible by applying well-known models of physics in physical spaces and mapping the laws of physics to virtual spaces.
Of Newton’s three laws of motion, the first law says that: Objects at rest stay at rest, objects in motion stay in motion. The game engine can apply this principle to objects by persisting their velocity, both the speed and the direction of the object’s movement. When updating the object’s position, the engine takes the vector representing the velocity of the object and applies it to the object’s position, modified by how much time went by since the last update. If the object has no velocity, it won’t move. If the object does have velocity, then it will appear to continuously move forward through the series of updates.
The second law of motion says that the acceleration of an object is related to all forces acting on an object, divided by its mass. When virtual objects strike against each other, the forces imparted can change the velocity of the object. Bigger forces cause larger changes in acceleration. In the game engine, the developer can configure the mass of the objects. With higher masses, the acceleration changes less, whereas with lighter masses, the acceleration changes significantly.
The third law of motion says that every action has an equal and opposite reaction. This can be modeled as objects bouncing off of one another, imparting forces against each other.
In addition to the three laws of motion, gravity can be turned on or off, applying a constant acceleration towards the ground. This gravity can be raised or lowered to simulate different gravitational conditions. So if you want to make it feel like you’re on a moon base with lower gravity or even a space station where everything seems like it’s floating, you can modify the gravity to make it feel that way.