| Package | com.boristhebrave.Box2DWith.Flint |
| Class | public class BodyZone |
| Implements | org.flintparticles.twoD.zones.Zone2D |
| Property | Defined by | ||
|---|---|---|---|
| body : b2Body The body to pick points from.
| BodyZone | ||
| byMass : Boolean Are points randomly weighted by mass, or by volume.
| BodyZone | ||
| local : Boolean Is the returned point in local or world co-ordinates.
| BodyZone | ||
| scale : Number The scale factor between Flint pixels and Box2D units, in pixels/unit.
| BodyZone | ||
| Method | Defined by | ||
|---|---|---|---|
|
BodyZone(body:b2Body, byMass:Boolean = true, local:Boolean = true, scale:Number)
Basic constructor
| BodyZone | ||
|
contains(x:Number, y:Number):Boolean
The contains method determines whether a point is inside the zone.
| BodyZone | ||
|
getArea():Number
The getArea method returns the size of the zone.
| BodyZone | ||
|
getLocation():Point
The getLocation method returns a random point inside the zone.
| BodyZone | ||
|
getShapeWeights():FastWeightedArray
Returns a FastWeightedArray with an entry for each shape in the body,
and weightings according to mass or volume.
| BodyZone | ||
| body | property |
public var body:b2BodyThe body to pick points from.
| byMass | property |
public var byMass:BooleanAre points randomly weighted by mass, or by volume.
| local | property |
public var local:BooleanIs the returned point in local or world co-ordinates.
| scale | property |
public var scale:NumberThe scale factor between Flint pixels and Box2D units, in pixels/unit.
| BodyZone | () | constructor |
public function BodyZone(body:b2Body, byMass:Boolean = true, local:Boolean = true, scale:Number)Basic constructor
Parametersbody:b2Body — The body get shapes from.
|
|
byMass:Boolean (default = true) — Scaling factor between Flint pixels and Box2D units in pixels/unit.
|
|
local:Boolean (default = true) — Should random locations be weighted by mass or by area.
|
|
scale:Number — If true, points are considered in the bodies local co-ordinates, not world co-ordinates.
|
| contains | () | method |
public function contains(x:Number, y:Number):BooleanThe contains method determines whether a point is inside the zone.
Parametersx:Number — The x coordinate of the location to test for.
|
|
y:Number — The y coordinate of the location to test for.
|
Boolean — true if point is inside the zone, false if it is outside.
|
| getArea | () | method |
public function getArea():NumberThe getArea method returns the size of the zone. It's used by the MultiZone class to manage the balancing between the different zones.
ReturnsNumber — the size of the zone.
|
| getLocation | () | method |
public function getLocation():PointThe getLocation method returns a random point inside the zone.
ReturnsPoint — a random point inside the zone.
|
| getShapeWeights | () | method |
public function getShapeWeights():FastWeightedArrayReturns a FastWeightedArray with an entry for each shape in the body, and weightings according to mass or volume.
ReturnsFastWeightedArray |