Public Attributes | List of all members
ime::PhysIterations Struct Reference

Controls the reaction of ime::RigidBody objects when they collide. More...

#include <PhysicsIterations.h>

Public Attributes

unsigned int position
 Position iterations per time-step. More...
 
unsigned int velocity
 Velocity iterations per time-step. More...
 

Detailed Description

Controls the reaction of ime::RigidBody objects when they collide.

When a collision is detected between two rigid bodies, a calculation is performed to resolve the collision (push the two bodies such that they no longer overlap). This calculation is performed by an iterative solver. The solver determines if and how the velocity and position of the two bodies should change. For example, when a ball hits a wall, it should as expected, bounce of the wall. A single iteration per update may not give accurate results as you may still see the ball overlap the wall. The velocity and position iterations affect the accuracy of the physics simulation.

There is a trade-off between performance and accuracy when selecting the iterations. Using fewer iterations increases performance but accuracy suffers. Likewise, using more iterations decreases performance but improves the quality the simulation simulation. You can play around with different combinations and observe how your simulations improves or degrades.

Note
Physics iterations are only valid for collision resolution between ime::RigidBody objects with ime::Collider attached to them. If your game does not make use of them, for example your only interested in grid-based physics (see ime::GridMover), then these values should be set to zero

Definition at line 56 of file PhysicsIterations.h.

Member Data Documentation

◆ position

unsigned int ime::PhysIterations::position

Position iterations per time-step.

Definition at line 57 of file PhysicsIterations.h.

◆ velocity

unsigned int ime::PhysIterations::velocity

Velocity iterations per time-step.

Definition at line 58 of file PhysicsIterations.h.


The documentation for this struct was generated from the following file: