Table of Contents

Class PhysicsBody

Namespace
Fantas.Physics
Assembly
Fantas.dll

Physics Body simulation object

public abstract class PhysicsBody
Inheritance
PhysicsBody
Derived
Inherited Members

Properties

AllContactedBodies

List of bodies in contact with this body

public PhysicsBody[] AllContactedBodies { get; }

Property Value

PhysicsBody[]

AllowsRotation

If body is allowed to rotate (Angular momentum)

public bool AllowsRotation { get; set; }

Property Value

bool

AngularVelocity

Angular velocity in radians per second.

public double AngularVelocity { get; set; }

Property Value

double

Area

Area of the physics body

public double Area { get; }

Property Value

double

Category

Body category

public int Category { get; set; }

Property Value

int

CollisionMask

Collision mask

public int CollisionMask { get; set; }

Property Value

int

ContactMask

Contact mask

public int ContactMask { get; set; }

Property Value

int

Density

Body Density

public double Density { get; set; }

Property Value

double

Dynamic

Tells if the body is affected by forces and impulses in the simulation.

public bool Dynamic { get; set; }

Property Value

bool

Friction

Surface roughness of the physics body. A value between 0.0 and 1.0, with a default of 0.2

public double Friction { get; set; }

Property Value

double

Joints

Joints that are connected to the physics body.

public PhysicsJoint[] Joints { get; }

Property Value

PhysicsJoint[]

Mass

Mass of the physics body. (Updates the density when set.)

public double Mass { get; set; }

Property Value

double

Node

Get the node this body is connected

public Node Node { get; }

Property Value

Node

Resting

Tells whether the body is resting on another body in the simulation, and thus does not participate in the simulation.

public bool Resting { get; set; }

Property Value

bool

Restitution

Proportion of energy, between 0.0 and 1.0, that the physics body loses when it bounces off of another physics body. The default is 0.2.

public double Restitution { get; set; }

Property Value

double

Velocity

Body motion velocity vector

public Vector2 Velocity { get; set; }

Property Value

Vector2

Methods

ApplyAngularImpulse(double)

Apply angular impulse to body

public void ApplyAngularImpulse(double impulse)

Parameters

impulse double

ApplyForce(Vector2)

Applies a force through the center of mass of the body

public void ApplyForce(Vector2 force)

Parameters

force Vector2

ApplyForce(Vector2, PointF)

Applies a force at the point to the body

public void ApplyForce(Vector2 force, PointF point)

Parameters

force Vector2
point PointF

ApplyImpulse(Vector2)

Applies a impulse at the point to the body

public void ApplyImpulse(Vector2 impulse)

Parameters

impulse Vector2

ApplyImpulse(Vector2, PointF)

Applies a impulse at the point to the body

public void ApplyImpulse(Vector2 impulse, PointF point)

Parameters

impulse Vector2
point PointF

ApplyTorque(double)

Applies a torque to the body

public void ApplyTorque(double torque)

Parameters

torque double

ContactWith(PhysicsBody)

Check if the body is in contact with another body

public bool ContactWith(PhysicsBody otherBody)

Parameters

otherBody PhysicsBody

Returns

bool

ContactWithAll(PhysicsBody[])

Check if this body is in contact with all given bodies

public bool ContactWithAll(PhysicsBody[] otherBodies)

Parameters

otherBodies PhysicsBody[]

Returns

bool

ContactWithAny(PhysicsBody[])

Check if this body is in contact with any of the given bodies

public bool ContactWithAny(PhysicsBody[] otherBodies)

Parameters

otherBodies PhysicsBody[]

Returns

bool