class nape.shape.Shape extends Interactor

Available on all platforms

Base type for Nape Shape's

Instance Fields

var angDrag:Float

Coeffecient of angular fluid drag for this Shape.

var area:Float

Area of the Hhape.

var body:Null<Body>

Body this Shape is assigned to. *

* This value can be set to add Shape to the given Body, and set to null * to remove it from its present Body. * * @default null

var bounds:AABB

World space bounding box for this shape. *

* This value can be accessed even if the Shape is not part of a Body, * however attempting to query its values would result in an error in * debug builds. *

* This AABB is immutable.

var castCircle:Null<Circle>

Faster equivalent to casting this to Circle type

var castPolygon:Null<Polygon>

Faster equivalent to casting this to Polygon type

var filter:InteractionFilter

InteractionFilter used by this shape. * * @default new InteractionFilter()

var fluidEnabled:Bool

Whether this shape is able to interact as a fluid. *

* Unless this field is true, this Shape can never interact as a fluid. *

* Just because this field is true however, does not mean this shape will always * interact as a fluid, the final result is down to the combination of * InteractionFilters on the pairing of shapes and sensory interaction * takes higher priority. * * @default false

var fluidProperties:FluidProperties

FluidProperties used by this shape. *

* This object provides information for buoyancy and fluid drag computations * when this shape is interacting as a fluid. * * @default new FluidProperties();

var inertia:Float

Non-mass weighted moment of inertia for Shape.

var localCOM:Vec2

Local space centre of mass of this Shape. *

* This Vec2 can be set and is equivalent to performing the necessary * translation of the Shape in local coordinates, and also equivalent * to this.localCOM.set(value). *
* Setting this value whilst this shape is part of a static Body that * is part of a Space is not permitted.

var material:Material

Material used by this shape. * * @default new Material()

var sensorEnabled:Bool

Whether this shape is able to interact as sensor. *

* Unless this field is true, this Shape can never interact as a sensor. *

* Just because this field is true however, does not mean this shape will always * interact as a sensor, the final result is down to the combination of * InteractionFilters on the pairing of shapes. Sensor interaction has highest priority. * * @default false

var type:ShapeType

Type of shape.

var worldCOM:Vec2

World space centre of mass of this Shape. *

* This value can be accessed even if Shape is not in a Body, but * attempting to query the values of it will return an error in debug * builds unless the Shape is in a Body. *

* This Vec2 is immutable.

var zpp_inner:ZPP_Shape

@private

function contains(point:Vec2):Bool

Test containment of world-space coordinate in Shape. *

* This Shape must be part of a Body so that world coordinates are * defined. * *

point

The point to check for containment. *

returns

True if point is contained within the Shape. *

function copy():Shape

Produce an exact copy of this Shape. *

* The copied shape will be identical with the copied Shape's userData * object being assigned the same fields as 'this' Shape with the same * values copied over by reference for object types. * *

returns

A copy of this shape.

function isCircle():Bool

Faster equivalent to type == ShapeType.CIRCLE * *

returns

True if shape is a Circle type.

function isPolygon():Bool

Faster equivalent to type == ShapeType.POLYGON * *

returns

True if shape is a Polygon type.

function rotate(angle:Float):Shape

Rotate this shape in its local coordinate system. * *

angle

The number of radians to rotate this Shape by in a clockwise * direction. *

returns

A reference to 'this' Shape. *

function scale(scalex:Float, scaley:Float):Shape

Scale this shape in its local coordinate system. *

* For Circle shapes, scalex and scaley must be exactly equal. * *

scalex

The x-coordinate scaling to apply to Shape. *

scaley

The y-coordinate scaling to apply to Shape. *

returns

A reference to 'this' Shape. *

function toString():String

@private

function transform(matrix:Mat23):Shape

Apply local transformation matrix to Shape. *

* For Circle shapes, the matrix must be equiorthogonal. * *

matrix

The matrix to transform Shape by. *

returns

A reference to 'this' Shape. *

function translate(translation:Vec2):Shape

Translate this shape in its local coordinate system. *

* This is equivalent to: shape.localCOM.addeq(displacement) * *

translation

The local translation to apply to Shape. *

returns

A reference to 'this' Shape. *