Fixture class

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. Fixtures are created via Body::CreateFixture.

@warning you cannot reuse fixtures.




hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
userData Object
Use this to store your application specific data.
read / write


computeDistance(Vector2 p, int childIndex, Vector2 normalOut) double
Compute the distance from this fixture. [...]
create(Body body, FixtureDef def) → void
createProxies(BroadPhase broadPhase, Transform xf) → void
destroy() → void
destroyProxies(BroadPhase broadPhase) → void
Internal method [...]
getAABB(int childIndex) AABB
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. [...]
getBody() Body
Get the parent body of this fixture. This is NULL if the fixture is not attached. [...]
getDensity() double
getFilterData() Filter
Get the contact filtering data. [...]
getFriction() double
Get the coefficient of friction. [...]
getMassData(MassData massData) → void
Get the mass data for this fixture. The mass data is based on the density and the shape. The rotational inertia is about the shape's origin. [...]
getNext() Fixture
Get the next fixture in the parent body's fixture list. [...]
getRestitution() double
Get the coefficient of restitution. [...]
getShape() Shape
Get the child shape. You can modify the child shape, however you should not change the number of vertices because this will crash some collision caching mechanisms. [...]
getType() ShapeType
Get the type of the child shape. You can use this to down cast to the concrete shape. [...]
isSensor() bool
Is this fixture a sensor (non-solid)? [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
raycast(RayCastOutput output, RayCastInput input, int childIndex) bool
Cast a ray against this shape. [...]
refilter() → void
Call this if you want to establish collision that was previously disabled by ContactFilter::ShouldCollide.
setDensity(double density) → void
setFilterData(Filter filter) → void
Set the contact filtering data. This is an expensive operation and should not be called frequently. This will not update contacts until the next time step when either parent body is awake. This automatically calls refilter. [...]
setFriction(double friction) → void
Set the coefficient of friction. This will not change the friction of existing contacts. [...]
setRestitution(double restitution) → void
Set the coefficient of restitution. This will not change the restitution of existing contacts. [...]
setSensor(bool sensor) → void
Set if this fixture is a sensor. [...]
synchronize(BroadPhase broadPhase, Transform transform1, Transform transform2) → void
Internal method [...]
testPoint(Vector2 p) bool
Test a point for containment in this fixture. This only works for convex shapes. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]