nape.phys.Body

type
class
extends
Interactor
Class representing a physics Rigid Body.

Constructor

function new(type:BodyType = DYNAMIC, position:nape.geom.Vec2 = (0,0))
+ Construct a new Body.

Instance Properties hide inherited show inherited

var allowMovement : Bool = true

+ Whether dynamic Body is permitted to be moved by physics linearly.

var allowRotation : Bool = true

+ Whether dynamic Body is permitted to be rotated by physics.

var angularVel : Float = 0

+ Angular velocity of Body in clockwise rad/s

readonly var arbiters : nape.dynamics.ArbiterList

+ Set of active arbiters related to this Body.

readonly var bounds : nape.geom.AABB

+ Bounding box of Body in world space.

readonly var castBody : Null<Body>

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

readonly var castCompound : Null<Compound>

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

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.

var compound : Null<Compound> = null

+ Compound this Body belongs to.

readonly var constraintInertia : Float

+ Moment of inertia to be used in user defined Constraints.

readonly var constraintMass : Float

+ Mass to be used for a Body in User built constraints.

readonly var constraintVelocity : nape.geom.Vec3

+ This property represents the velocity seen by constraint physics.

readonly var constraints : nape.constraint.ConstraintList

+ Set of constraints using this Body.

var debugDraw : Bool = true

+ Set to disable debug drawing/

var disableCCD : Bool = false

+ Declare object should never be collided continuously

var force : nape.geom.Vec2 = (0,0)

+ Accumulated force acting on body in px.kg/s/s

var gravMass : Float

+ Mass used in gravity computations in a Space.

var gravMassMode : GravMassMode = GravMassMode.DEFAULT

+ Method of computing mass as seen by gravity.

var gravMassScale : Float

+ Mass scale used in computation of gravity for Body in Space.

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.

var inertia : Float

+ Moment of inertia of this Body.

var inertiaMode : InertiaMode = InertiaMode.DEFAULT

+ Method of computing Body moment of inertia.

var isBullet : Bool = false

+ Mark object for continuous collisions against other dynamic Bodies

readonly var isSleeping : Bool

+ Whether this body is sleeping.

var kinAngVel : Float = 0

+ Additional kinematic angular velocity of Body in rad/s.

var kinematicVel : nape.geom.Vec2 = (0,0)

+ Additional kinematic velocity of Body in px/s.

readonly var localCOM : nape.geom.Vec2

+ Local centre of mass of Body.

var mass : Float

+ Mass of the Body.

var massMode : MassMode = MassMode.DEFAULT

+ Method of mass computation for Body.

var position : nape.geom.Vec2 = (0,0)

+ Position of Body's origin in px.

var rotation : Float = 0

+ Rotation of Body in clockwise rad.

readonly var shapes : nape.shape.ShapeList = []

+ List of shapes owned by Body.

var space : Null<nape.space.Space>

+ Space this Body is assigned to.

var surfaceVel : nape.geom.Vec2 = (0,0)

+ Additional surface velocity for Body in px/s.

var torque : Float = 0

+ Accumulated torque acting on body in px.px.kg/s/s

var type : BodyType

+ Type of body.

readonly var userData : Dynamic<Dynamic> = {}

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

var velocity : nape.geom.Vec2 = (0,0)

+ Linear velocity of Body's origin in px/s.

readonly var worldCOM : nape.geom.Vec2

+ World centre of mass of Body.

Instance Methods hide inherited show inherited

function align():Body

+ Align rigid body so that its origin is also its centre of mass.

function applyAngularImpulse(impulse:Float, sleepable:Bool = false):Body

+ Apply a pure angular impulse to Body.

function applyImpulse(impulse:nape.geom.Vec2, pos:nape.geom.Vec2 = body.position, sleepable:Bool = false):Body

+ Apply impulse to a point on Body.

function buoyancyImpulse(body:Body = null):nape.geom.Vec3

+ Evaluate sum effect of all buoyancy impulses acting on Body.

function connectedBodies(depth:Int = -1, output:BodyList = null):BodyList

+ Compute set of bodies connected via constraints.

function constraintsImpulse():nape.geom.Vec3

+ Evaluate sum effect of all constraint impulses on this Body.

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

+ Determine if point is contained in Body.

function copy():Body

+ Construct an exact copy of this Body.

function crushFactor():Float

+ Determine how much this body is being crushed.

function dragImpulse(body:Body = null):nape.geom.Vec3

+ Evaluate sum effect of all fluid drag impulses acting on Body.

function integrate(deltaTime:Float):Body

+ Integrate body forward in time, taking only velocities into account.

function interactingBodies(type:nape.callbacks.InteractionType = null, depth:Int = -1, output:BodyList = null):BodyList

+ Compute set of bodies interacting with this body.

isBody():Bool

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

isCompound():Bool

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

inline function isDynamic():Bool

+ Fast equivalent to body.type == BodyType.DYNAMIC

inline function isKinematic():Bool

+ Fast equivalent to body.type == BodyType.KINEMATIC

isShape():Bool

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

inline function isStatic():Bool

+ Fast equivalent to body.type == BodyType.STATIC

function localPointToWorld(point:nape.geom.Vec2, weak:Bool = false):nape.geom.Vec2

+ Transform a point from Body's local coordinates to world coordinates.

function localVectorToWorld(vector:nape.geom.Vec2, weak:Bool = false):nape.geom.Vec2

+ Transform vector from Body's local coordinates into world coordinates.

function normalImpulse(body:Body = null, freshOnly:Bool = false):nape.geom.Vec3

+ Evaluate sum effect of all normal contact impulses on Body.

function rollingImpulse(body:Body = null, freshOnly:Bool = false):Float

+ Evaluate sum effect of all rolling friction contact impulses on Body.

function rotate(centre:nape.geom.Vec2, angle:Float):Body

+ Rotate body about about given point.

function rotateShapes(angle:Float):Body

+ Rotate each shape in local coordinates.

function scaleShapes(scaleX:Float, scaleY:Float):Body

+ Scale each shape in local coordinates.

function setShapeFilters(filter:nape.dynamics.InteractionFilter):Body

+ Set interaction filter of all shapes.

function setShapeFluidProperties(fluidProperties:FluidProperties):Body

+ Set fluidProperties of all shapes.

function setShapeMaterials(material:Material):Body

+ Set material of all shapes.

function setVelocityFromTarget(targetPosition:nape.geom.Vec2, targetRotation:Float, deltaTime:Float):Body

+ Set velocities to achieve desired position at end of time step.

function tangentImpulse(body:Body = null, freshOnly:Bool = false):nape.geom.Vec3

+ Evaluate sum effect of all tangent contact impulses on Body.

function totalContactsImpulse(body:Body = null, freshOnly:Bool = false):nape.geom.Vec3

+ Evaluate sum effect of all contact impulses on Body.

function totalFluidImpulse(body:Body = null):nape.geom.Vec3

+ Evaluate sum effect of all fluid impulses acting on Body.

function totalImpulse(body:Body = null, freshOnly:Bool = false):nape.geom.Vec3

+ Evaluate sum effect of all impulses on Body.

function transformShapes(matrix:nape.geom.Mat23):Body

+ Transform each shape in local coordiantes.

function translateShapes(translation:nape.geom.Vec2):Body

+ Translate each shape in local coordinates.

function worldPointToLocal(point:nape.geom.Vec2, weak:Bool = false):nape.geom.Vec2

+ Transform a point from world coordinates to Body's local coordinates.

function worldVectorToLocal(vector:nape.geom.Vec2, weak:Bool = false):nape.geom.Vec2

+ Transform vector from world coordinates to Body's local coordinates