Aether.Physics2D  1.7
Fixture Class Reference

A fixture is used to attach a Shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as friction, collision filters, etc. More...

Public Member Functions

 Fixture (Shape shape)
 
bool TestPoint (ref Vector2 point)
 Test a point for containment in this fixture. More...
 
bool RayCast (out RayCastOutput output, ref RayCastInput input, int childIndex)
 Cast a ray against this Shape. More...
 
void GetAABB (out AABB aabb, int childIndex)
 Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a more accurate AABB, compute it using the Shape and the body transform. More...
 
Fixture CloneOnto (Body body)
 Clones the fixture onto the specified body. More...
 

Public Attributes

AfterCollisionEventHandler AfterCollision
 Fires after two shapes has collided and are solved. This gives you a chance to get the impact force. More...
 
BeforeCollisionEventHandler BeforeCollision
 Fires when two fixtures are close to each other. Due to how the broadphase works, this can be quite inaccurate as shapes are approximated using AABBs. More...
 
OnCollisionEventHandler OnCollision
 Fires when two shapes collide and a contact is created between them. Note that the first fixture argument is always the fixture that the delegate is subscribed to. More...
 
OnSeparationEventHandler OnSeparation
 Fires when two shapes separate and a contact is removed between them. Note: This can in some cases be called multiple times, as a fixture can have multiple contacts. Note The first fixture argument is always the fixture that the delegate is subscribed to. More...
 
object Tag
 Set the user data. Use this to store your application specific data. More...
 

Properties

FixtureProxy[] Proxies [get]
 
int ProxyCount [get]
 
short CollisionGroup [get, set]
 Defaults to 0 More...
 
Category CollidesWith [get, set]
 Defaults to Category.All More...
 
Category CollisionCategories [get, set]
 The collision categories this fixture is a part of. More...
 
Shape Shape [get]
 Get the child Shape. More...
 
bool IsSensor [get, set]
 Gets or sets a value indicating whether this fixture is a sensor. More...
 
Body Body [get, set]
 Get the parent body of this fixture. This is null if the fixture is not attached. More...
 
float Friction [get, set]
 Set the coefficient of friction. This will not change the friction of existing contacts. More...
 
float Restitution [get, set]
 Set the coefficient of restitution. This will not change the restitution of existing contacts. More...
 

Detailed Description

A fixture is used to attach a Shape to a body for collision detection. A fixture inherits its transform from its parent. Fixtures hold additional non-geometric data such as friction, collision filters, etc.

Member Function Documentation

◆ CloneOnto()

Fixture CloneOnto ( Body  body)

Clones the fixture onto the specified body.

Parameters
bodyThe body you wish to clone the fixture onto.
Returns
The cloned fixture.

◆ GetAABB()

void GetAABB ( out AABB  aabb,
int  childIndex 
)

Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a more accurate AABB, compute it using the Shape and the body transform.

Parameters
aabbThe aabb.
childIndexIndex of the child.

◆ RayCast()

bool RayCast ( out RayCastOutput  output,
ref RayCastInput  input,
int  childIndex 
)

Cast a ray against this Shape.

Parameters
outputThe ray-cast results.
inputThe ray-cast input parameters.
childIndexIndex of the child.
Returns

◆ TestPoint()

bool TestPoint ( ref Vector2  point)

Test a point for containment in this fixture.

Parameters
pointA point in world coordinates.
Returns

Member Data Documentation

◆ AfterCollision

AfterCollisionEventHandler AfterCollision

Fires after two shapes has collided and are solved. This gives you a chance to get the impact force.

◆ BeforeCollision

BeforeCollisionEventHandler BeforeCollision

Fires when two fixtures are close to each other. Due to how the broadphase works, this can be quite inaccurate as shapes are approximated using AABBs.

◆ OnCollision

OnCollisionEventHandler OnCollision

Fires when two shapes collide and a contact is created between them. Note that the first fixture argument is always the fixture that the delegate is subscribed to.

◆ OnSeparation

OnSeparationEventHandler OnSeparation

Fires when two shapes separate and a contact is removed between them. Note: This can in some cases be called multiple times, as a fixture can have multiple contacts. Note The first fixture argument is always the fixture that the delegate is subscribed to.

◆ Tag

object Tag

Set the user data. Use this to store your application specific data.

The user data.

Property Documentation

◆ Body

Body Body
getset

Get the parent body of this fixture. This is null if the fixture is not attached.

The body.

◆ CollidesWith

Category CollidesWith
getset

Defaults to Category.All

The collision mask bits. This states the categories that this fixture would accept for collision.

◆ CollisionCategories

Category CollisionCategories
getset

The collision categories this fixture is a part of.

Defaults to Category.Cat1

◆ CollisionGroup

short CollisionGroup
getset

Defaults to 0

Collision groups allow a certain group of objects to never collide (negative) or always collide (positive). Zero means no collision group. Non-zero group filtering always wins against the mask bits.

◆ Friction

float Friction
getset

Set the coefficient of friction. This will not change the friction of existing contacts.

The friction.

◆ IsSensor

bool IsSensor
getset

Gets or sets a value indicating whether this fixture is a sensor.

true if this instance is a sensor; otherwise, false.

◆ Restitution

float Restitution
getset

Set the coefficient of restitution. This will not change the restitution of existing contacts.

The restitution.

◆ Shape

Shape Shape
get

Get the child Shape.

The shape.


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