## DynamX Engine

Posted by Gamer3D on December 18, 2007A stable 2D rigid-body physics engine. Later updates will include speed increases and error fixes.

### » Add a Screenshot

### Functions:

Advances the simulation by time (in seconds).

Adds a shape to the simulation and returns the handle.

Returns **The handle of the polygon**

Adds a point to the shape.

Returns the area of the shape.

Returns **The area of the polygon**

Destroys the polygon, freeing the memory.

Sets the default gravity for objects.

Adds an object to the simulation and returns the handle.

Returns **The handle of the object**

Applies an impulse to the object. This function is mainly experimental.

Sets the position of the object

Returns the object's X position.

Returns **The object's X position**

Returns the object's Y position.

Returns **The object's Y position**

Sets the object's velocity vector (in units per second).

Returns the object's horizontal velocity.

Returns **The object's horizontal velocity**

Returns the object's vertical velocity.

Returns **The object's vertical velocity**

Sets the object's orientation in radians.

Returns the object's orientation in radians.

Returns **The object's orientation**

Sets the object's angular velocity (speed of rotation) in radians per second.

Returns the object's angular velocity (speed of rotation) in radians per second.

Returns **The object's angular velocity**

Sets the density of the object.

Returns the mass of the object.

Returns **The object's mass**

Sets whether the object is anchored (fixed in one position).

Sets the gravity of the object.

Sets the friction of the object.

Sets the elasticity (bounciness) of the object.

Returns the handle of the last object that this object has collided with.

Returns **The handle of the last object collided with**

Removes the object from the simulation.

Returns the number of objects being simulated.

Returns **The number of simulated objects**

### Comments:

**Schyler**

This is actually alright.

When I added my own object though it froze when they went on top of each other.

Not sure about using it in a game.

**Gamer3D**

Hmm... I didn't think it even could freeze. I had designed it without the possibility of an infinite loop...