Class CAAT.Foundation.Box2D.B2DBodyActor
Extends
CAAT.Foundation.Actor.
Defined in: B2DBodyActor.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
BodyData object linked to the box2D body.
|
|
Box2D body definition.
|
|
Dynamic bodies by default
|
|
Body dentisy
|
|
Box2D fixture definition.
|
|
Body friction.
|
|
Recycle this actor when the body is not needed anymore ??
|
|
Body restitution.
|
|
Box2D world reference.
|
|
Box2D body
|
|
Box2d fixture
|
- Fields borrowed from class CAAT.Foundation.Actor:
- __super, AABB, alpha, backgroundImage, behaviorList, cached, clip, clipPath, dirty, discardable, duration, expired, fillStyle, frameAlpha, gestureEnabled, glEnabled, height, id, inFrame, invalid, isAA, isCachedActor, isGlobalAlpha, lifecycleListenerList, minimumSize, modelViewMatrix, modelViewMatrixI, mouseEnabled, oldX, oldY, parent, pointed, preferredSize, preventLayout, rotationAngle, rotationX, rotationY, scaleAnchor, scaleTX, scaleTY, scaleX, scaleY, size_active, size_total, start_time, strokeStyle, tAnchorX, tAnchorY, time, viewVertices, visible, wdirty, width, worldModelViewMatrix, worldModelViewMatrixI, x, y
Method Attributes | Method Name and Description |
---|---|
<private> |
__init()
|
animate(director, time)
Method override to get position and rotation angle from box2d body.
|
|
check(obj, prop, def)
Helper method to check whether this js object contains a given property and if it doesn't exist
create and set it to def value.
|
|
createBody(world, bodyData)
Create an actor as a box2D body binding, create it on the given world and with
the initialization data set in bodyData object.
|
|
destroy()
|
|
Get this body's center on screen regardless of its shape.
|
|
Get a distance joint's position on pixels.
|
|
setAwake(bool)
|
|
setBodyType(bodyType)
Set this body's type:
|
|
setDensity(d)
Set this body's
density.
|
|
setFriction(f)
Set this body's friction.
|
|
setLocation(x, y)
|
|
setPositionAnchor(ax, ay)
|
|
setPositionAnchored(x, y, ax, ay)
|
|
set this actor to recycle its body, that is, do not destroy it.
|
|
Set this body's restitution coeficient.
|
|
setSleepingAllowed(bool)
|
- Methods borrowed from class CAAT.Foundation.Actor:
- __paintActor, __scale1To, __validateLayout, addAnimation, addBehavior, addListener, cacheAsBitmap, centerAt, centerOn, clean, contains, create, disableDrag, drawScreenBoundingBox, emptyBehaviorList, enableDrag, enableEvents, endAnimate, findActorAtPosition, findActorById, fireEvent, gestureChange, gestureEnd, gestureStart, getAnchor, getAnchorPercent, getBehavior, getId, getMinimumSize, getPreferredSize, getTextureGLPage, glNeedsFlush, glSetShader, initialize, invalidate, invalidateLayout, isCached, isGestureEnabled, isInAnimationFrame, isVisible, modelToModel, modelToView, mouseClick, mouseDblClick, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseOut, mouseOver, mouseUp, moveTo, paint, paintActor, paintActorGL, playAnimation, removeBehaviorById, removeBehaviour, removeListener, resetAnimationTime, resetAsButton, resetTransform, rotateTo, scaleTo, scaleXTo, scaleYTo, setAlpha, setAnimationEndCallback, setAnimationImageIndex, setAsButton, setBackgroundImage, setBackgroundImageOffset, setBounds, setButtonImageIndex, setCachedActor, setChangeFPS, setClip, setDiscardable, setExpired, setFillStyle, setFrameTime, setGestureEnabled, setGLCoords, setGlobalAlpha, setGlobalAnchor, setId, setImageTransformation, setMinimumSize, setModelViewMatrix, setOutOfFrameTime, setPaint, setParent, setPosition, setPreferredSize, setPreventLayout, setRotation, setRotationAnchor, setRotationAnchored, setScale, setScaleAnchor, setScaleAnchored, setScreenBounds, setSize, setSpriteIndex, setStrokeStyle, setUV, setVisible, stopCacheAsBitmap, touchEnd, touchMove, touchStart, viewToModel
Field Detail
bodyData
BodyData object linked to the box2D body.
bodyDef
Box2D body definition.
bodyType
Dynamic bodies by default
density
Body dentisy
fixtureDef
Box2D fixture definition.
friction
Body friction.
recycle
Recycle this actor when the body is not needed anymore ??
restitution
Body restitution.
world
Box2D world reference.
worldBody
Box2D body
worldBodyFixture
Box2d fixture
Method Detail
<private>
__init()
animate(director, time)
Method override to get position and rotation angle from box2d body.
- Parameters:
- director
- {CAAT.Director}
- time
- {number}
check(obj, prop, def)
Helper method to check whether this js object contains a given property and if it doesn't exist
create and set it to def value.
- Parameters:
- obj
- {object}
- prop
- {string}
- def
- {object}
createBody(world, bodyData)
Create an actor as a box2D body binding, create it on the given world and with
the initialization data set in bodyData object.
- Parameters:
- world
- {Box2D.Dynamics.b2World} a Box2D world instance
- bodyData
- {object} An object with body info.
destroy()
getCenter()
Get this body's center on screen regardless of its shape.
This method will return box2d body's centroid.
getDistanceJointLocalAnchor()
Get a distance joint's position on pixels.
setAwake(bool)
- Parameters:
- bool
setBodyType(bodyType)
Set this body's type:
- Parameters:
- bodyType
- {Box2D.Dynamics.b2Body.b2_*}
setDensity(d)
Set this body's
density.
- Parameters:
- d
- {number}
setFriction(f)
Set this body's friction.
- Parameters:
- f
- {number}
setLocation(x, y)
- Parameters:
- x
- y
setPositionAnchor(ax, ay)
- Parameters:
- ax
- ay
setPositionAnchored(x, y, ax, ay)
- Parameters:
- x
- y
- ax
- ay
setRecycle()
set this actor to recycle its body, that is, do not destroy it.
setRestitution(r)
Set this body's restitution coeficient.
- Parameters:
- r
- {number}
setSleepingAllowed(bool)
- Parameters:
- bool