PackageBox2D.Dynamics
Classpublic class b2Fixture
Sourceb2Fixture.as

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 b2Body::CreateFixture.

Warning: you cannot reuse fixtures.



Public Methods
 MethodDefined by
  
Get the fixture's AABB.
b2Fixture
  
Get the parent body of this fixture.
b2Fixture
  
GetDensity():Number
Get the density of this fixture.
b2Fixture
  
Get the contact filtering data.
b2Fixture
  
GetFriction():Number
Get the coefficient of friction.
b2Fixture
  
GetMassData(massData:b2MassData = null):b2MassData
Get the mass data for this fixture.
b2Fixture
  
Get the next fixture in the parent body's fixture list.
b2Fixture
  
GetRestitution():Number
Get the coefficient of restitution.
b2Fixture
  
Get the child shape.
b2Fixture
  
GetType():int
Get the type of the child shape.
b2Fixture
  
Get the user data that was assigned in the fixture definition.
b2Fixture
  
IsSensor():Boolean
Is this fixture a sensor (non-solid)?
b2Fixture
  
RayCast(output:b2RayCastOutput, input:b2RayCastInput):Boolean
Perform a ray cast against this shape.
b2Fixture
  
SetDensity(density:Number):void
Set the density of this fixture.
b2Fixture
  
Set the contact filtering data.
b2Fixture
  
SetFriction(friction:Number):void
Set the coefficient of friction.
b2Fixture
  
SetRestitution(restitution:Number):void
Get the coefficient of restitution.
b2Fixture
  
SetSensor(sensor:Boolean):void
Set if this fixture is a sensor.
b2Fixture
  
SetUserData(data:*):void
Set the user data.
b2Fixture
  
TestPoint(p:b2Vec2):Boolean
Test a point for containment in this fixture.
b2Fixture
Method detail
GetAABB()method
public function GetAABB():b2AABB

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.

Returns
b2AABB
GetBody()method 
public function GetBody():b2Body

Get the parent body of this fixture. This is NULL if the fixture is not attached.

Returns
b2Body — the parent body.
GetDensity()method 
public function GetDensity():Number

Get the density of this fixture.

Returns
Number — density
GetFilterData()method 
public function GetFilterData():b2FilterData

Get the contact filtering data.

Returns
b2FilterData
GetFriction()method 
public function GetFriction():Number

Get the coefficient of friction.

Returns
Number
GetMassData()method 
public function GetMassData(massData:b2MassData = null):b2MassData

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:b2MassData (default = null) — - this is a reference to a valid massData, if it is null a new b2MassData is allocated and then returned

Returns
b2MassData
GetNext()method 
public function GetNext():b2Fixture

Get the next fixture in the parent body's fixture list.

Returns
b2Fixture — the next shape.
GetRestitution()method 
public function GetRestitution():Number

Get the coefficient of restitution.

Returns
Number
GetShape()method 
public function GetShape():b2Shape

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.

Returns
b2Shape
GetType()method 
public function GetType():int

Get the type of the child shape. You can use this to down cast to the concrete shape.

Returns
int — the shape type.
GetUserData()method 
public function GetUserData():*

Get the user data that was assigned in the fixture definition. Use this to store your application specific data.

Returns
*
IsSensor()method 
public function IsSensor():Boolean

Is this fixture a sensor (non-solid)?

Returns
Boolean — the true if the shape is a sensor.
RayCast()method 
public function RayCast(output:b2RayCastOutput, input:b2RayCastInput):Boolean

Perform a ray cast against this shape.

Parameters
output:b2RayCastOutput — the ray-cast results.
 
input:b2RayCastInput — the ray-cast input parameters.

Returns
Boolean
SetDensity()method 
public function SetDensity(density:Number):void

Set the density of this fixture. This will _not_ automatically adjust the mass of the body. You must call b2Body::ResetMassData to update the body's mass.

Parameters
density:Number
SetFilterData()method 
public function SetFilterData(filter:b2FilterData):void

Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and awake.

Parameters
filter:b2FilterData
SetFriction()method 
public function SetFriction(friction:Number):void

Set the coefficient of friction.

Parameters
friction:Number
SetRestitution()method 
public function SetRestitution(restitution:Number):void

Get the coefficient of restitution.

Parameters
restitution:Number
SetSensor()method 
public function SetSensor(sensor:Boolean):void

Set if this fixture is a sensor.

Parameters
sensor:Boolean
SetUserData()method 
public function SetUserData(data:*):void

Set the user data. Use this to store your application specific data.

Parameters
data:*
TestPoint()method 
public function TestPoint(p:b2Vec2):Boolean

Test a point for containment in this fixture.

Parameters
p:b2Vec2 — the shape world transform.

Returns
Boolean