@physion/app / Exports / BodyNode
Class: BodyNode
This is the base class for all bodies.
Hierarchy
-
↳
BodyNode↳↳
CapsuleNode↳↳
CircleNode
Constructors
constructor
• new BodyNode(): BodyNode
Returns
Overrides
Properties
userData
• userData: Record<string, unknown>
Inherited from
EVT_CHILD_ADDED
▪ Static Readonly EVT_CHILD_ADDED: "childAdded"
The name of the event that is emitted whenever a child is added to this node.
The argument supplied is the child that was just added to this node.
Inherited from
EVT_CHILD_REMOVED
▪ Static Readonly EVT_CHILD_REMOVED: "childRemoved"
The name of the event that is emitted whenever a child is removed from this node.
The argument supplied is the child that was just removed from this node.
Inherited from
GraphicsNode.EVT_CHILD_REMOVED
EVT_CHILD_REORDERED
▪ Static Readonly EVT_CHILD_REORDERED: "childReordered"
The name of the event that is emitted whenever a child of this node is reordered.
The arguments supplied are: (1) The child that was just reordered (2) the old index of the child and (3) the new index of the child.
Inherited from
GraphicsNode.EVT_CHILD_REORDERED
EVT_NAME_CHANGED
▪ Static Readonly EVT_NAME_CHANGED: "nameChanged"
The name of the event that is emitted whenever the name of this object changes.
The argument suplied is the new CoreObject.name of the object.
Inherited from
EVT_PROPERTY_CHANGED
▪ Static Readonly EVT_PROPERTY_CHANGED: "propertyChanged"
The name of the event that is emitted whenever a property of this object changes.
The arguments supplied are: (1) The name of the property that has changed and (2) the new value of that property.
Inherited from
GraphicsNode.EVT_PROPERTY_CHANGED
EVT_TRANSFORM_CHANGED
▪ Static Readonly EVT_TRANSFORM_CHANGED: "transformChanged"
The name of the event that is emitted whenever the x, y or angle properties of this Node are changed.
Note that this event is not emitted when x, y or angle properties are changed as a result of
an update().
Inherited from
GraphicsNode.EVT_TRANSFORM_CHANGED
ID_LENGTH
▪ Static Readonly ID_LENGTH: 12
Inherited from
MAX_NAME_LENGTH
▪ Static Readonly MAX_NAME_LENGTH: 128
Inherited from
Accessors
active
• get active(): boolean
Returns true if this body is active, otherwise returns false.
An inactive body will be visualized but it won't participate in the simulation.
Returns
boolean
• set active(v): void
Sets this body's active property
Parameters
| Name | Type |
|---|---|
v | boolean |
Returns
void
allowSleep
• get allowSleep(): boolean
Returns true if this body is allowed to sleep, otherwise returns false.
By default, all bodies are allowed to sleep. This basically means that when a body has come to rest and it has no collisions then it will go to sleep. Setting a body to sleep reduces then number of object we have to simulated (thus increasing performance).
Returns
boolean
• set allowSleep(v): void
Sets this body's allowSleep property
Parameters
| Name | Type |
|---|---|
v | boolean |
Returns
void
alpha
• get alpha(): number
Node's alpha
This value is between 0 (transparent) and 1.0 (opaque). This property can be considered as the "master" opacity of the node. Defaults to 1 (fully opaque)
Returns
number
Inherited from
GraphicsNode.alpha
• set alpha(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Inherited from
GraphicsNode.alpha
angle
• get angle(): number
Returns the angle (in degrees) of this body
Returns
number
Overrides
GraphicsNode.angle
• set angle(v): void
Sets the angle (in degrees) of this body
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
Overrides
GraphicsNode.angle
angularDamping
• get angularDamping(): number
Returns
number
• set angularDamping(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
angularVelocity
• get angularVelocity(): number
Returns
number
• set angularVelocity(v): void
Parameters
| Name | Type |
|---|---|
v | number |
Returns
void
blendMode
• get blendMode(): BLEND_MODES
Returns
BLEND_MODES
Inherited from
GraphicsNode.blendMode
• set blendMode(v): void
Parameters
| Name | Type |
|---|---|
v | BLEND_MODES |
Returns
void
Inherited from
GraphicsNode.blendMode
body
• get body(): undefined | b2Body
Returns
undefined | b2Body
bodyType
• get bodyType(): BodyType
Returns the body type of this body.
Returns
BodyType
• set bodyType(v): void
Sets this body's bodyType property
Parameters
| Name | Type |
|---|---|
v | BodyType |
Returns
void
bullet
• get bullet(): boolean
Returns true if this body is a bullet, otherwise returns false.
This property only affects dynamic bodies. If a dynamic body is set to be a bullet then continuous collision detection (CCD) will be used and scenarios where a fast moving object tunels through other bodies are avoided. Note that bullets are more computational expensive.
Returns
boolean
• set bullet(v): void
Sets this body's bullet property
Parameters
| Name | Type |
|---|---|
v | boolean |
Returns
void
childCount
• get childCount(): number
Returns the number of children this node contains.
Returns
number
Inherited from
GraphicsNode.childCount