Wambui Kimani
3 min readMay 31, 2021

--

A Vector State of Mind

The most important thing to note in physics engine is that vector mathemaatics/ linear algebra is very important. When a basketball is thrown it will generally move at a constant velocity. The ball will also move vertically, its motions is not constant as gravity affects it. Newton’s equations points out that while the ball moves forward it is simulatenously moving up and down because of gravity’s influence.

Points as Vectors

Like arrows vectors have a direction and they also have length. Their position in space is not absoluteThey do not have an absolute position in space. When you are modeling a point as a vector, you should make the simple assumption that the vector tail is at point (0,0).

Newton’s 2nd Law of Motion

Newton’s 2nd law is very important to us. There are two reasons why this formula is very powerful. The first reason is forces can be defined asthe way objects interact with each other in the real world. the second reason is you are able to calculate an object’s position and its velocity if you know an object’s acceleration. you can model any phsyical scenario accurately if you are able to model the forces correctly.

Calculating Velocity and Position

The realtionship between accelaration, positon and velocity is helpful when programming using physics engine as if the history of an object’s history is known then it is not diificult to to figure out the velocity. We can also caluclate its acceleratoin by answering the question “In the last second, how much did this object move?”

Rigid Bodies

Rigid bodies are known to have an orientation and shape. They are able to rotate, and can also collide with each other. Particles are known to be point-masses . They do not have a shape nor a size. They also do not have an orientation. Particles are in fact the simplest form of physical entity to that can be modelled. A degree of complexity is added when Modeling is done on something with a shape should rotate.

Collision Detection

Collision detection is one of the most complicated aspects of physics engines. Collision detection is a very costly operation an operation can have hundreds of objects, a lot of effeort is directed at optimizing algotithm for collission detection.

Separating Axis Theorem

There are two majormethods used for collision detection. GJK is the first method, is used commonly for 3D collision detection as the algorithm that will be uses is costly when it is done in 3D. The separating axis theorem is used mostly for 2D collision detection. it is much easier to visulaize and conceptualize.

Collision Response

Once objects are determined to collide, they’re needs to have a reaction to it of some way of reaction. Much of this will be dependent on the mechanics of the game . When a bullet fired at a character it should cause some damage. A missile on the other hand should cause some damage and should then explode. But today we’ll look at a very physical response: two boxes knocking into each other and bouncing away. When two hard objects collide, the momentum of the two objects does not change. Real objects are not hard to a level of perfection, so we then introduce a fudge factor known as the coefficient of restitution, which simply models the elasticity of the collision.

--

--