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.

Do note that you cannot reuse fixtures.


Fixture(Body body, FixtureDef def)


body Body
density double
getter/setter pair
filterData Filter
Get the contact filtering data.
getter/setter pair
friction double
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isSensor bool
Is this fixture a sensor (non-solid)?
no setter
proxies List<FixtureProxy>
proxyCount int
no setter
renderAxis Vector2
renderCenter Vector2
restitution double
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape Shape
getter/setter pair
type ShapeType
Get the type of the child shape. You can use this to down cast to the concrete shape.
no setter
userData Object?
Use this to store your application specific data.
getter/setter pair


computeDistance(Vector2 point, int childIndex, Vector2 normalOut) double
Compute the distance from this fixture.
createProxies(BroadPhase broadPhase, Transform xf) → 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.
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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.
render(DebugDraw debugDraw, Transform xf, Color3i color, bool wireframe) → void
setSensor(bool sensor) → void
Set if this fixture is a sensor.
synchronize(BroadPhase broadPhase, Transform transform1, Transform transform2) → void
testPoint(Vector2 point) 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.


liquidFlag → const int