Shape subtype representing a Circle
Constructor
@:value({ filter : null, material : null, localCOM : null })new(radius:Float, ?localCOM:Vec2, ?material:Material, ?filter:InteractionFilter)
Construct a new Circle
Parameters:
radius | The radius of the circle, this value must be positive. |
---|---|
localCOM | The local offset for the circle. (default (0,0)) |
material | The material for this circle. (default new Material()) |
filter | The interaction filter for this circle. (default new InteractionFilter()) |
Returns:
The constructed Circle
Throws:
# | If radius is not strictly positive |
---|---|
# | If localCOM is non-null, but has been disposed of. |
Variables
Inherited Variables
Defined by Shape
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.
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.
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.
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.
Defined by 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 *
This object will be lazily constructed so that until accessed
for the first time, will be null internally.
Inherited Methods
Defined by Shape
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. |
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. |
Defined by Interactor
inlineisBody():Bool
Fast equivalent to (interactor is Body)
Returns:
true if this Interactor is a Body.
inlineisCompound():Bool
Fast equivalent to (interactor is Compound)
Returns:
true if this Interactor is a Compound.