A shape is used for collision detection. Shapes are created in b2World.
You can use shape for collision detection before they are attached to the world.
b2internal var m_body:b2Body
b2internal var m_density:Number
b2internal var m_friction:Number
b2internal var m_next:b2Shape
b2internal var m_restitution:Number
b2internal var m_sweepRadius:Number
b2internal var m_type:int
public function b2Shape(def:b2ShapeDef)
Parameters
public function ComputeAABB(aabb:b2AABB, xf:b2XForm):void
Given a transform, compute the associated axis aligned bounding box for this shape.
Parameters
| aabb:b2AABB — returns the axis aligned box.
|
|
| xf:b2XForm — the world transform of the shape.
|
public function ComputeMass(massData:b2MassData):void
Compute the mass properties of this shape using its dimensions and density.
The inertia tensor is computed about the local origin, not the centroid.
Parameters
| massData:b2MassData — returns the mass data for this shape.
|
public function ComputeSweptAABB(aabb:b2AABB, xf1:b2XForm, xf2:b2XForm):void
Given two transforms, compute the associated swept axis aligned bounding box for this shape.
Parameters
| aabb:b2AABB — returns the axis aligned box.
|
|
| xf1:b2XForm — the starting shape world transform.
|
|
| xf2:b2XForm — the ending shape world transform.
|
public static function Create(def:b2ShapeDef, allocator:*):b2Shape
Parameters
Returns
public function CreateProxy(broadPhase:b2BroadPhase, transform:b2XForm):void
Parameters
public static function Destroy(shape:b2Shape, allocator:*):void
Parameters
public function DestroyProxy(broadPhase:b2BroadPhase):void
Parameters
public function GetBody():b2Body
Get the parent body of this shape. This is NULL if the shape is not attached.
Returns
public function GetFilterData():b2FilterData
Get the contact filtering data.
Returns
public function GetFriction():Number
Get the coefficient of friction.
Returns
public function GetNext():b2Shape
Get the next shape in the parent body's shape list.
Returns
public function GetRestitution():Number
Get the coefficient of restitution.
Returns
public function GetSweepRadius():Number
Get the maximum radius about the parent body's center of mass.
Returns
public function GetType():int
Get the type of this shape. You can use this to down cast to the concrete shape.
Returns
public function GetUserData():*
Get the user data that was assigned in the shape definition. Use this to
store your application specific data.
Returns
public function IsSensor():Boolean
Is this shape a sensor (non-solid)?
Returns
| Boolean — the true if the shape is a sensor.
|
public function RefilterProxy(broadPhase:b2BroadPhase, transform:b2XForm):void
Parameters
public function SetFilterData(filter:b2FilterData):void
Set the contact filtering data. You must call b2World::Refilter to correct
existing contacts/non-contacts.
Parameters
public function SetUserData(data:*):void
Set the user data. Use this to store your application specific data.
Parameters
public function Synchronize(broadPhase:b2BroadPhase, transform1:b2XForm, transform2:b2XForm):Boolean
Parameters
Returns
public function TestPoint(xf:b2XForm, p:b2Vec2):Boolean
Test a point for containment in this shape. This only works for convex shapes.
Parameters
| xf:b2XForm — the shape world transform.
|
|
| p:b2Vec2 — a point in world coordinates.
|
Returns
public function TestSegment(xf:b2XForm, lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):Boolean
Perform a ray cast against this shape.
Parameters
| xf:b2XForm — the shape world transform.
|
|
| lambda:Array — returns the hit fraction. You can use this to compute the contact point
p = (1 - lambda) segment.p1 + lambda segment.p2.
|
|
| normal:b2Vec2 — returns the normal at the contact point. If there is no intersection, the normal
is not set.
|
|
| segment:b2Segment — defines the begin and end point of the ray cast.
|
|
| maxLambda:Number — a number typically in the range [0,1].
|
Returns
| Boolean — true if there was an intersection.
|
public function UpdateSweepRadius(center:b2Vec2):void
Parameters
public static const e_circleShape:int = 0
public static const e_polygonShape:int = 1
public static const e_shapeTypeCount:int = 2
public static const e_unknownShape:int = -1