class nape.shape.Shape extends Interactor
Available on all platforms
Sub classes | ||||||
![]() | Circle, Polygon |
|
Base type for Nape Shape's
Instance Fields
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
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 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();
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 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
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.
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. * |
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 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. * |