Appearance
Class: 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.
To create a new Fixture use Body.createFixture.
Properties
style
style:
Style={}
Styling for dev-tools.
Methods
createProxies()
createProxies(
broadPhase,xf):void
These support body activation/deactivation.
Parameters
broadPhase
xf
Returns
void
destroyProxies()
destroyProxies(
broadPhase):void
Parameters
broadPhase
Returns
void
getAABB()
getAABB(
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.
Parameters
childIndex
number
Returns
getBody()
getBody():
Body
Get the parent body of this fixture. This is null if the fixture is not attached.
Returns
getDensity()
getDensity():
number
Get the density of this fixture.
Returns
number
getFilterCategoryBits()
getFilterCategoryBits():
number
Returns
number
getFilterGroupIndex()
getFilterGroupIndex():
number
Returns
number
getFilterMaskBits()
getFilterMaskBits():
number
Returns
number
getFriction()
getFriction():
number
Get the coefficient of friction, usually in the range [0,1].
Returns
number
getMassData()
getMassData(
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. This operation may be expensive.
Parameters
massData
Returns
void
getNext()
getNext():
Fixture
Get the next fixture in the parent body's fixture list.
Returns
Fixture
getRestitution()
getRestitution():
number
Get the coefficient of restitution.
Returns
number
getShape()
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. Manipulating the shape may lead to non-physical behavior.
Returns
getType()
getType():
ShapeType
Get the type of the child shape. You can use this to down cast to the concrete shape.
Returns
getUserData()
getUserData():
unknown
Get the user data that was assigned in the fixture definition. Use this to store your application specific data.
Returns
unknown
isSensor()
isSensor():
boolean
A sensor shape collects contact information but never generates a collision response.
Returns
boolean
rayCast()
rayCast(
output,input,childIndex):boolean
Cast a ray against this shape.
Parameters
output
input
childIndex
number
Returns
boolean
refilter()
refilter():
void
Call this if you want to establish collision that was previously disabled by ContactFilter.
Returns
void
setDensity()
setDensity(
density):void
Set the density of this fixture. This will not automatically adjust the mass of the body. You must call Body.resetMassData to update the body's mass.
Parameters
density
number
Returns
void
setFilterCategoryBits()
setFilterCategoryBits(
categoryBits):void
Parameters
categoryBits
number
Returns
void
setFilterData()
setFilterData(
filter):void
Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and awake. This automatically calls refilter.
Parameters
filter
categoryBits
number
groupIndex
number
maskBits
number
Returns
void
setFilterGroupIndex()
setFilterGroupIndex(
groupIndex):void
Parameters
groupIndex
number
Returns
void
setFilterMaskBits()
setFilterMaskBits(
maskBits):void
Parameters
maskBits
number
Returns
void
setFriction()
setFriction(
friction):void
Set the coefficient of friction. This will not change the friction of existing contacts.
Parameters
friction
number
Returns
void
setRestitution()
setRestitution(
restitution):void
Set the coefficient of restitution. This will not change the restitution of existing contacts.
Parameters
restitution
number
Returns
void
setSensor()
setSensor(
sensor):void
Set if this fixture is a sensor.
Parameters
sensor
boolean
Returns
void
setUserData()
setUserData(
data):void
Set the user data. Use this to store your application specific data.
Parameters
data
unknown
Returns
void
shouldCollide()
shouldCollide(
that):boolean
Implement this method to provide collision filtering, if you want finer control over contact creation.
Return true if contact calculations should be performed between these two fixtures.
Warning: for performance reasons this is only called when the AABBs begin to overlap.
Parameters
that
Fixture
Returns
boolean
synchronize()
synchronize(
broadPhase,xf1,xf2):void
Updates this fixture proxy in broad-phase (with combined AABB of current and next transformation).
Parameters
broadPhase
xf1
xf2
Returns
void
testPoint()
testPoint(
p):boolean
Test a point in world coordinates for containment in this fixture.
Parameters
p
Returns
boolean