nape.shape.Polygon

type
class
extends
Shape
Polygon subtype of Shape.

Can be used to simulate any convex polygon.

Static Methods

static function box(width:Float, height:Float, weak:Bool = false):Array<nape.geom.Vec2>

+ Construct a polygon representing an origin centred box.

static function rect(x:Float, y:Float, width:Float, height:Float, weak:Bool = false):Array<nape.geom.Vec2>

+ Construct a polygon representing a rectangle.

static function regular(xRadius:Float, yRadius:Float, edgeCount:Int, angleOffset:Float = 0.0, weak:Bool = false):Array<nape.geom.Vec2>

+ Construct a regular polygon centred at origin.

Constructor

function new(localVerts:Dynamic, material:nape.phys.Material = new Material(), filter:nape.dynamics.InteractionFilter = new InteractionFilter())
+ Construct a new Polygon.

Instance Properties hide inherited show inherited

readonly var angDrag : Float

inherited from nape.shape.Shape
Coeffecient of angular fluid drag for this Shape.

readonly var area : Float

inherited from nape.shape.Shape
Area of the Hhape.

var body : Null<nape.phys.Body> = null

inherited from nape.shape.Shape
+ Body this Shape is assigned to.

readonly var bounds : nape.geom.AABB

inherited from nape.shape.Shape
+ World space bounding box for this shape.

readonly var castBody : Null<Body>

inherited from nape.phys.Interactor
Fast equivalent to cast(interactor, Body)

readonly var castCircle : Null<Circle>

inherited from nape.shape.Shape
Faster equivalent to casting this to Circle type

readonly var castCompound : Null<Compound>

inherited from nape.phys.Interactor
Fast equivalent to cast(interactor, Compound)

readonly var castPolygon : Null<Polygon>

inherited from nape.shape.Shape
Faster equivalent to casting this to Polygon type

readonly var castShape : Null<nape.shape.Shape>

inherited from nape.phys.Interactor
Fast equivalent to cast(interactor, Shape)

readonly var cbTypes : nape.callbacks.CbTypeList = []

inherited from nape.phys.Interactor
Set of CbType's assigned to this Interactor.

readonly var edges : EdgeList

+ Set of edges on polygon.

var filter : nape.dynamics.InteractionFilter = new InteractionFilter()

inherited from nape.shape.Shape
InteractionFilter used by this shape.

var fluidEnabled : Bool = false

inherited from nape.shape.Shape
+ Whether this shape is able to interact as a fluid.

var fluidProperties : nape.phys.FluidProperties = new FluidProperties();

inherited from nape.shape.Shape
+ FluidProperties used by this shape.

var group : Null<nape.dynamics.InteractionGroup> = null

inherited from nape.phys.Interactor
InteractionGroup assigned to this Interactor.

readonly var id : Int

inherited from nape.phys.Interactor
Unique id of this Interactor.

readonly var inertia : Float

inherited from nape.shape.Shape
Non-mass weighted moment of inertia for Shape.

var localCOM : nape.geom.Vec2

inherited from nape.shape.Shape
+ Local space centre of mass of this Shape.

readonly var localVerts : nape.geom.Vec2List

+ Local coordinates of vertices.

var material : nape.phys.Material = new Material()

inherited from nape.shape.Shape
Material used by this shape.

var sensorEnabled : Bool = false

inherited from nape.shape.Shape
+ Whether this shape is able to interact as sensor.

readonly var type : ShapeType

inherited from nape.shape.Shape
Type of shape.

readonly var userData : Dynamic<Dynamic> = {}

inherited from nape.phys.Interactor
+ Dynamic object for user to store additional data.

readonly var worldCOM : nape.geom.Vec2

inherited from nape.shape.Shape
+ World space centre of mass of this Shape.

readonly var worldVerts : nape.geom.Vec2List

+ World coordinates of vertices.

Instance Methods hide inherited show inherited

contains(point:nape.geom.Vec2):Bool

inherited from nape.shape.Shape
+ Test containment of world-space coordinate in Shape.

copy():Shape

inherited from nape.shape.Shape
+ Produce an exact copy of this Shape.

isBody():Bool

inherited from nape.phys.Interactor
+ Fast equivalent to Std.is(interactor, Body)

isCircle():Bool

inherited from nape.shape.Shape
+ Faster equivalent to type == ShapeType.CIRCLE

isCompound():Bool

inherited from nape.phys.Interactor
+ Fast equivalent to Std.is(interactor, Compound)

isPolygon():Bool

inherited from nape.shape.Shape
+ Faster equivalent to type == ShapeType.POLYGON

isShape():Bool

inherited from nape.phys.Interactor
+ Fast equivalent to Std.is(interactor, Shape)

rotate(angle:Float):Shape

inherited from nape.shape.Shape
+ Rotate this shape in its local coordinate system.

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

inherited from nape.shape.Shape
+ Scale this shape in its local coordinate system.

transform(matrix:nape.geom.Mat23):Shape

inherited from nape.shape.Shape
+ Apply local transformation matrix to Shape.

translate(translation:nape.geom.Vec2):Shape

inherited from nape.shape.Shape
+ Translate this shape in its local coordinate system.

function validity():ValidationResult

Determine validity of polygon for use in a Nape simulation.