Base type for Nape Shape's

Variables

read onlyangDrag:Float

Coeffecient of angular fluid drag for this Shape.

read onlyarea:Float

Area of the Hhape.

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.

read onlybounds: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.

read onlycastCircle:Null<Circle>

Faster equivalent to casting this to Circle type

read onlycastPolygon:Null<Polygon>

Faster equivalent to casting this to Polygon type

filter:InteractionFilter

InteractionFilter used by this shape.

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.

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.

read onlyinertia:Float

Non-mass weighted moment of inertia for Shape.

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.

material:Material

Material used by this shape.

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.

read onlytype:ShapeType

Type of shape.

read onlyworldCOM: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.

@:value(null)zpp_inner:ZPP_Shape = null

@private

Methods

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.

Parameters:

point

The point to check for containment.

Returns:

True if point is contained within the Shape.

Throws:

If

point is null or disposed of.

If

this shape is not part of a Body.

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.

inlineisCircle():Bool

Faster equivalent to type == ShapeType.CIRCLE

Returns:

True if shape is a Circle type.

inlineisPolygon():Bool

Faster equivalent to type == ShapeType.POLYGON

Returns:

True if shape is a Polygon type.

rotate(angle:Float):Shape

Rotate this shape in its local coordinate system.

Parameters:

angle

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

Returns:

A reference to 'this' Shape.

Throws:

#

If this shape is part of a static body that is inside of a Space.

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

Scale this shape in its local coordinate system.

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

Parameters:

scalex

The x-coordinate scaling to apply to Shape.

scaley

The y-coordinate scaling to apply to Shape.

Returns:

A reference to 'this' Shape.

Throws:

#

If this shape is part of a static body that is inside of a Space.

#

If scalex or scaley is 0. Negative values 'are' permitted.

@:keeptoString():String

@private

transform(matrix:Mat23):Shape

Apply local transformation matrix to Shape.

For Circle shapes, the matrix must be equiorthogonal.

Parameters:

matrix

The matrix to transform Shape by.

Returns:

A reference to 'this' Shape.

Throws:

#

If matrix is null or singular.

#

If shape is a Circle, and matrix is not equiorthogonal.

#

If this shape is part of a static body that is inside of a Space.

translate(translation:Vec2):Shape

Translate this shape in its local coordinate system.

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

Parameters:

translation

The local translation to apply to Shape.

Returns:

A reference to 'this' Shape.

Throws:

#

If translation is null or has been disposed of.

#

If this shape is part of a static body that is inside of a Space.

Static variables

@:value(false)staticzpp_internalAlloc:Bool = false

@private

Inherited Variables

Defined by Interactor

read onlycastBody:Null<Body>

Fast equivalent to cast(interactor, Body)

read onlycastCompound:Null<Compound>

Fast equivalent to cast(interactor, Compound)

read onlycastShape:Null<Shape>

Fast equivalent to cast(interactor, Shape)

read onlycbTypes:CbTypeList

Set of CbType's assigned to this Interactor.

group:Null<InteractionGroup>

InteractionGroup assigned to this Interactor.

read onlyid:Int

Unique id of this Interactor.

read onlyuserData:Dynamic<Dynamic>

Dynamic object for user to store additional data.

This object cannot be set, only its dynamically created properties may be set. In AS3 the type of this property is &#42

This object will be lazily constructed so that until accessed for the first time, will be null internally.

@:value(null)zpp_inner_i:ZPP_Interactor = null

@private

Inherited Methods

Defined by Interactor

inlineisBody():Bool

Fast equivalent to Std.is(interactor, Body)

Returns:

true if this Interactor is a Body.

inlineisCompound():Bool

Fast equivalent to Std.is(interactor, Compound)

Returns:

true if this Interactor is a Compound.

inlineisShape():Bool

Fast equivalent to Std.is(interactor, Shape)

Returns:

true if this Interactor is a Shape.