SimplePhysicsEngine

SimplePhysicsEngine

SimplePhysicsEngine is a pseudo-physics engine which works with objects of class DynamicObject. The Simple Physics Engine is a "fake" physics engine, which is more appropriate for arcade games, and it is sometimes referred to as "arcade" physics. For example if a character is standing at the edge of a platform, with only one foot on the platform, it won't fall over. This is a desired game behaviour in platformer games.

Constructor

new SimplePhysicsEngine(options)

Creates an instance of the Simple Physics Engine.

Parameters:
Name Type Description
options Object

physics options

Properties
Name Type Description
collisions Object

collision options

Properties
Name Type Description
type String

can be set to "HSHG" or "bruteForce". Default is Brute-Force collision detection.

collisionDistance Number

for brute force, this can be set for a simple distance-based (radius) collision detection.

autoResolve Boolean

for brute force collision, colliding objects should be moved apart

gravity TwoVector

TwoVector instance which describes gravity, which will be added to the velocity of all objects at every step. For example TwoVector(0, -0.01)

Source:

Members

(static) gravity :TwoVector

The actor's name.

Source: