Fixture
Declaration
public class tainicom.Aether.Physics2D.Dynamics.Fixture
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.
Constructors
Fixture
void Fixture(Shape shape)
Parameters:
| Name | Type | Description |
|---|---|---|
shape |
tainicom.Aether.Physics2D.Collision.Shapes.Shape |
Properties
Proxies
FixtureProxy[] Proxies { get }
ProxyCount
int ProxyCount { get }
CollisionGroup
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.
short CollisionGroup { get set }
CollidesWith
Defaults to Category.All The collision mask bits. This states the categories that this fixture would accept for collision.
Category CollidesWith { get set }
CollisionCategories
The collision categories this fixture is a part of. Defaults to Category.Cat1
Category CollisionCategories { get set }
Shape
Get the child Shape.
Shape Shape { get }
Value: The shape.
IsSensor
Gets or sets a value indicating whether this fixture is a sensor.
bool IsSensor { get set }
Value: true if this instance is a sensor; otherwise, false.
Body
Get the parent body of this fixture. This is null if the fixture is not attached.
Body Body { get }
Value: The body.
Friction
Set the coefficient of friction. This will not change the friction of existing contacts.
float Friction { get set }
Value: The friction.
Restitution
Set the coefficient of restitution. This will not change the restitution of existing contacts.
float Restitution { get set }
Value: The restitution.
Fields
AfterCollision
Fires after two shapes has collided and are solved. This gives you a chance to get the impact force.
AfterCollisionEventHandler AfterCollision
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.
BeforeCollisionEventHandler BeforeCollision
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.
OnCollisionEventHandler OnCollision
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.
OnSeparationEventHandler OnSeparation
Tag
Set the user data. Use this to store your application specific data.
object Tag
Value: The user data.
Methods
TestPoint
Test a point for containment in this fixture.
bool TestPoint(ref Vector2 point)
Parameters:
| Name | Type | Description |
|---|---|---|
point |
ref Strawberry.Math.Vector2 |
A point in world coordinates. |
RayCast
Cast a ray against this Shape.
bool RayCast(out RayCastOutput output, ref RayCastInput input, int childIndex)
Parameters:
| Name | Type | Description |
|---|---|---|
output |
out tainicom.Aether.Physics2D.Collision.RayCastOutput |
The ray-cast results. |
input |
ref tainicom.Aether.Physics2D.Collision.RayCastInput |
The ray-cast input parameters. |
childIndex |
System.Int32 |
Index of the child. |
GetAABB
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.
void GetAABB(out AABB aabb, int childIndex)
Parameters:
| Name | Type | Description |
|---|---|---|
aabb |
out tainicom.Aether.Physics2D.Collision.AABB |
The aabb. |
childIndex |
System.Int32 |
Index of the child. |
CloneOnto
Clones the fixture onto the specified body.
Fixture CloneOnto(Body body)
Parameters:
| Name | Type | Description |
|---|---|---|
body |
tainicom.Aether.Physics2D.Dynamics.Body |
The body you wish to clone the fixture onto. |
Returns: The cloned fixture.