Class Fixture
- Namespace
- Alis.Core.Physic.Dynamics
- Assembly
- Alis.dll
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.
public class Fixture
Inheritance
Inherited Members
Constructors
Fixture()
Initializes a new instance of the Alis.Core.Physic.Dynamics.Fixture class
internal Fixture()
Fixture(Shape)
Initializes a new instance of the Alis.Core.Physic.Dynamics.Fixture class
public Fixture(Shape shape)
Parameters
shape
Shape-
The shape
Fields
AfterCollision
Fires after two shapes has collided and are solved. This gives you a chance to get the impact force.
public AfterCollisionEventHandler AfterCollision
Field Value
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.
public BeforeCollisionEventHandler BeforeCollision
Field Value
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.
public OnCollisionEventHandler OnCollision
Field Value
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.
public OnSeparationEventHandler OnSeparation
Field Value
Tag
Set the user data. Use this to store your application specific data.
public object Tag
Field Value
_collidesWith
The collides with
internal Category _collidesWith
Field Value
_collisionCategories
The collision categories
internal Category _collisionCategories
Field Value
_collisionGroup
The collision group
internal short _collisionGroup
Field Value
_friction
The friction
private float _friction
Field Value
_isSensor
The is sensor
private bool _isSensor
Field Value
_restitution
The restitution
private float _restitution
Field Value
Properties
Body
Get the parent body of this fixture. This is null if the fixture is not attached.
public Body Body { get; internal set; }
Property Value
CollidesWith
Defaults to Category.All The collision mask bits. This states the categories that this fixture would accept for collision.
public Category CollidesWith { get; set; }
Property Value
CollisionCategories
The collision categories this fixture is a part of. Defaults to Category.Cat1
public Category CollisionCategories { get; set; }
Property Value
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.
public short CollisionGroup { get; set; }
Property Value
Friction
Set the coefficient of friction. This will not change the friction of existing contacts.
public float Friction { get; set; }
Property Value
IsSensor
Gets or sets a value indicating whether this fixture is a sensor.
public bool IsSensor { get; set; }
Property Value
Proxies
Gets the value of the proxies
public FixtureProxy[] Proxies { get; }
Property Value
ProxyCount
Gets or sets the value of the proxy count
public int ProxyCount { get; private set; }
Property Value
Restitution
Set the coefficient of restitution. This will not change the restitution of existing contacts.
public float Restitution { get; set; }
Property Value
Shape
Get the child Shape.
public Shape Shape { get; }
Property Value
Methods
CloneOnto(Body)
Clones the fixture onto the specified body.
public Fixture CloneOnto(Body body)
Parameters
body
Body-
The body you wish to clone the fixture onto.
Returns
- Fixture
-
The cloned fixture.
CloneOnto(Body, Shape)
Clones the fixture and attached shape onto the specified body. Note: This is used only by Deserialization.
internal Fixture CloneOnto(Body body, Shape shape)
Parameters
Returns
- Fixture
-
The cloned fixture.
CreateProxies(IBroadPhase, ref Transform)
Creates the proxies using the specified broad phase
internal void CreateProxies(IBroadPhase broadPhase, ref Transform xf)
Parameters
broadPhase
IBroadPhase-
The broad phase
xf
Transform-
The xf
Exceptions
- InvalidOperationException
-
Proxies allready created for this Fixture.
DestroyProxies(IBroadPhase)
Destroys the proxies using the specified broad phase
internal void DestroyProxies(IBroadPhase broadPhase)
Parameters
broadPhase
IBroadPhase-
The broad phase
GetAABB(out AABB, int)
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.
public void GetAABB(out AABB aabb, int childIndex)
Parameters
RayCast(out RayCastOutput, ref RayCastInput, int)
Cast a ray against this Shape.
public bool RayCast(out RayCastOutput output, ref RayCastInput input, int childIndex)
Parameters
output
RayCastOutput-
The ray-cast results.
input
RayCastInput-
The ray-cast input parameters.
childIndex
int-
Index of the child.
Returns
Refilter()
Contacts are persistant and will keep being persistant unless they are flagged for filtering. This methods flags all contacts associated with the body for filtering.
private void Refilter()
Synchronize(IBroadPhase, ref Transform, ref Transform)
Synchronizes the broad phase
internal void Synchronize(IBroadPhase broadPhase, ref Transform transform1, ref Transform transform2)
Parameters
broadPhase
IBroadPhase-
The broad phase
transform1
Transform-
The transform
transform2
Transform-
The transform
TestPoint(ref Vector2)
Test a point for containment in this fixture.
public bool TestPoint(ref Vector2 point)
Parameters
point
Vector2-
A point in world coordinates.
Returns
TouchProxies(IBroadPhase)
Touch each proxy so that new pairs may be created
internal void TouchProxies(IBroadPhase broadPhase)
Parameters
broadPhase
IBroadPhase