Skip to main content

@physion/app / Exports / WeldJointNode

Class: WeldJointNode

IMPORTANT: x, y and angle properties don't make sense for joints.

Hierarchy​

Constructors​

constructor​

• new WeldJointNode(bodyNodeAid?, bodyNodeBid?, anchorA?, anchorB?, referenceAngle?): WeldJointNode

Parameters​

NameTypeDefault value
bodyNodeAidstring""
bodyNodeBidstring""
anchorAIPointundefined
anchorBIPointundefined
referenceAnglenumberdefaultWeldJointOpt.referenceAngle

Returns​

WeldJointNode

Overrides​

JointNode.constructor

Properties​

userData​

• userData: Record<string, unknown>

Inherited from​

JointNode.userData


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​

JointNode.EVT_CHILD_ADDED


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​

JointNode.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​

JointNode.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​

JointNode.EVT_NAME_CHANGED


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​

JointNode.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​

JointNode.EVT_TRANSFORM_CHANGED


ID_LENGTH​

▪ Static Readonly ID_LENGTH: 12

Inherited from​

JointNode.ID_LENGTH


MAX_NAME_LENGTH​

▪ Static Readonly MAX_NAME_LENGTH: 128

Inherited from​

JointNode.MAX_NAME_LENGTH

Accessors​

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​

JointNode.alpha

• set alpha(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.alpha


anchorA​

• get anchorA(): IPoint

Returns​

IPoint

Inherited from​

JointNode.anchorA

• set anchorA(v): void

Parameters​

NameType
vIPoint

Returns​

void

Inherited from​

JointNode.anchorA


anchorB​

• get anchorB(): IPoint

Returns​

IPoint

Inherited from​

JointNode.anchorB

• set anchorB(v): void

Parameters​

NameType
vIPoint

Returns​

void

Inherited from​

JointNode.anchorB


angle​

• get angle(): number

Node's angle (in degrees)

Returns​

number

Inherited from​

JointNode.angle

• set angle(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.angle


blendMode​

• get blendMode(): BLEND_MODES

Returns​

BLEND_MODES

Inherited from​

JointNode.blendMode

• set blendMode(v): void

Parameters​

NameType
vBLEND_MODES

Returns​

void

Inherited from​

JointNode.blendMode


bodyNodeAid​

• get bodyNodeAid(): string

Returns​

string

Inherited from​

JointNode.bodyNodeAid

• set bodyNodeAid(v): void

Parameters​

NameType
vstring

Returns​

void

Inherited from​

JointNode.bodyNodeAid


bodyNodeBid​

• get bodyNodeBid(): string

Returns​

string

Inherited from​

JointNode.bodyNodeBid

• set bodyNodeBid(v): void

Parameters​

NameType
vstring

Returns​

void

Inherited from​

JointNode.bodyNodeBid


childCount​

• get childCount(): number

Returns the number of children this node contains.

Returns​

number

Inherited from​

JointNode.childCount


children​

• get children(): Node[]

Returns the children of this node.

Returns​

Node[]

Inherited from​

JointNode.children


dampingRatio​

• get dampingRatio(): number

Returns​

number

• set dampingRatio(v): void

Parameters​

NameType
vnumber

Returns​

void


fillAlpha​

• get fillAlpha(): number

Returns​

number

Inherited from​

JointNode.fillAlpha

• set fillAlpha(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.fillAlpha


fillColor​

• get fillColor(): number

Returns​

number

Inherited from​

JointNode.fillColor

• set fillColor(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.fillColor


fillMatrix​

• get fillMatrix(): IMatrix

Returns​

IMatrix

Inherited from​

JointNode.fillMatrix

• set fillMatrix(v): void

Parameters​

NameType
vIMatrix

Returns​

void

Inherited from​

JointNode.fillMatrix


fillStyle​

• get fillStyle(): FillStyle

Returns​

FillStyle

Inherited from​

JointNode.fillStyle


fillTexture​

• get fillTexture(): string

Returns​

string

Inherited from​

JointNode.fillTexture

• set fillTexture(v): void

Parameters​

NameType
vstring

Returns​

void

Inherited from​

JointNode.fillTexture


flags​

• get flags(): CoreObjectFlags

Returns​

CoreObjectFlags

Inherited from​

JointNode.flags


frequencyHz​

• get frequencyHz(): number

Returns​

number

• set frequencyHz(v): void

Parameters​

NameType
vnumber

Returns​

void


graphics​

• get graphics(): Graphics

Returns​

Graphics

Inherited from​

JointNode.graphics


id​

• get id(): string

Object's (unique) id

Note that the id of the object cannot be set (it is automatically assigned upon construction)

Returns​

string

Inherited from​

JointNode.id


joint​

• get joint(): undefined | b2Joint

Returns​

undefined | b2Joint

Inherited from​

JointNode.joint


lineAlignment​

• get lineAlignment(): number

Returns​

number

Inherited from​

JointNode.lineAlignment

• set lineAlignment(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.lineAlignment


lineAlpha​

• get lineAlpha(): number

The line alpha used when drawing the graphics.

Returns​

number

Inherited from​

JointNode.lineAlpha

• set lineAlpha(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.lineAlpha


lineColor​

• get lineColor(): number

The line color used when drawing the graphics.

Returns​

number

Inherited from​

JointNode.lineColor

• set lineColor(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.lineColor


lineNative​

• get lineNative(): boolean

Returns​

boolean

Inherited from​

JointNode.lineNative

• set lineNative(v): void

Parameters​

NameType
vboolean

Returns​

void

Inherited from​

JointNode.lineNative


lineStyle​

• get lineStyle(): LineStyle

Returns​

LineStyle

Inherited from​

JointNode.lineStyle


lineWidth​

• get lineWidth(): number

The line width used when drawing the graphics.

Returns​

number

Inherited from​

JointNode.lineWidth

• set lineWidth(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.lineWidth


metaObject​

• get metaObject(): MetaObject

Returns the MetaObject that describes this class

Returns​

MetaObject

Overrides​

JointNode.metaObject


name​

• get name(): string

The object's name

The object's name is a free text value which defaults to an empty string.

Note that when the name of the object changes, the CoreObject.EVT_NAME_CHANGED signal will be emitted.

Returns​

string

Inherited from​

JointNode.name

• set name(v): void

Parameters​

NameType
vstring

Returns​

void

Inherited from​

JointNode.name


parent​

• get parent(): undefined | Node

Returns the parent of this node (or undefined if this node has no parent).

Returns​

undefined | Node

Inherited from​

JointNode.parent


referenceAngle​

• get referenceAngle(): number

Returns​

number

• set referenceAngle(v): void

Parameters​

NameType
vnumber

Returns​

void


scene​

• get scene(): undefined | Scene

Returns​

undefined | Scene

Inherited from​

JointNode.scene


scripts​

• get scripts(): IScript[]

Returns​

IScript[]

Inherited from​

JointNode.scripts

• set scripts(v): void

Parameters​

NameType
vIScript[]

Returns​

void

Inherited from​

JointNode.scripts


size​

• get size(): number

Returns​

number

• set size(v): void

Parameters​

NameType
vnumber

Returns​

void


ttl​

• get ttl(): number

Node's time-to-live, in milliseconds.

A value of -1 (the default) means this node has no ttl and will never be automatically removed. Any other value counts down while the simulation is running; once it reaches 0 the node (and any nodes that depend on it) is removed from the Scene.

Has no effect on the Scene node itself, which never counts down or gets removed via ttl.

Returns​

number

Inherited from​

JointNode.ttl

• set ttl(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.ttl


visualFilters​

• get visualFilters(): IVisualFilters

The visual effects drawn over this node and its children, keyed by types.VisualFilterKey. See VisualFiltersMixin.

Returns​

IVisualFilters

Inherited from​

JointNode.visualFilters

• set visualFilters(v): void

Parameters​

NameType
vIVisualFilters

Returns​

void

Inherited from​

JointNode.visualFilters


x​

• get x(): number

Node's x position (in meters)

Returns​

number

Inherited from​

JointNode.x

• set x(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.x


y​

• get y(): number

Node's y position (in meters)

Returns​

number

Inherited from​

JointNode.y

• set y(v): void

Parameters​

NameType
vnumber

Returns​

void

Inherited from​

JointNode.y

Methods​

addChild​

▸ addChild(child): boolean

Adds the given child to this node.

If the given child is already contained in this node or it already has a Node.parent then this method will fail (false will be returned).

Otherwise the child will be added to this node and the Node.EVT_CHILD_ADDED signal will be emitted.

Parameters​

NameTypeDescription
childNodeThe child to be added to this node.

Returns​

boolean

True on success otherwise false.

Inherited from​

JointNode.addChild


addChildren​

▸ addChildren(children): void

Convenience method for adding multiple children to this node.

Parameters​

NameType
childrenNode[]

Returns​

void

Inherited from​

JointNode.addChildren


addScript​

▸ addScript(assetId, params?): undefined | IScript

Adds a new script to this node.

Convenience wrapper around the scripts property, which validates the entry and rejects it if malformed. An entry whose asset is not available yet stays inert until it is.

Parameters​

NameTypeDescription
assetIdstringThe id of the script's TextAsset.
paramsScriptParamsInitial values for the script's editable properties.

Returns​

undefined | IScript

A copy of the added script entry, or undefined if it was rejected. Use its id with getNodeScript() or removeScript().

Inherited from​

JointNode.addScript


autoAdjustFillTexture​

▸ autoAdjustFillTexture(): Promise<void>

Returns​

Promise<void>

Inherited from​

JointNode.autoAdjustFillTexture


callMethodForAllNodeScripts​

▸ callMethodForAllNodeScripts<T>(methodName, ...args): void

Type parameters​

NameType
Textends NodeScriptMethodName

Parameters​

NameType
methodNameT
...argsParameters<NonNullable<INodeScriptValue[T]>>

Returns​

void

Inherited from​

JointNode.callMethodForAllNodeScripts


canAddChild​

▸ canAddChild(child): boolean

Returns true if the given child can be added to this node

Parameters​

NameType
childNode

Returns​

boolean

Inherited from​

JointNode.canAddChild


canRemoveChild​

▸ canRemoveChild(child): boolean

Returns true if the given child can be removed from this node

Parameters​

NameType
childNode

Returns​

boolean

Inherited from​

JointNode.canRemoveChild


canResolveDependencies​

▸ canResolveDependencies(): boolean

Returns​

boolean

Inherited from​

JointNode.canResolveDependencies


childIndex​

▸ childIndex(child): number

Returns the index of the given child (or -1 if child is not contained in thie node).

Parameters​

NameType
childNode

Returns​

number

Inherited from​

JointNode.childIndex


clone​

▸ clone(): WeldJointNode

Creates and returns a clone of this node.

The clone returned will have the same property values as this node except from its CoreObject.id.

Returns​

WeldJointNode

A clone of this node.

Inherited from​

JointNode.clone


containsChild​

▸ containsChild(child): boolean

Returns true if this node contains the given child

Parameters​

NameType
childNode

Returns​

boolean

Inherited from​

JointNode.containsChild


copyFillTextureFrom​

▸ copyFillTextureFrom(source): void

Copies the source's already-resolved texture directly, instead of just the fillTexture id (which would force a fresh async reload and flash the default white fill in the meantime).

Note: this node may not be attached to a scene yet, so don't call updateFillTexture() here to "double check" - it can't find its asset without a scene and would reset us back to white. onEnterScene() re-resolves the texture once the node actually gets attached.

Parameters​

NameType
sourceGraphicsNode

Returns​

void

Inherited from​

JointNode.copyFillTextureFrom


destroy​

▸ destroy(): void

Returns​

void

Overrides​

JointNode.destroy


findAncestorByClassName​

▸ findAncestorByClassName(className): undefined | Node

Parameters​

NameType
classNamestring

Returns​

undefined | Node

Inherited from​

JointNode.findAncestorByClassName


findChildById​

▸ findChildById(id): undefined | Node

Finds and returns the child with the given id.

Parameters​

NameTypeDescription
idstringThe CoreObject.id of the child to search for.

Returns​

undefined | Node

The child with the given id or undefined if no such child exists.

Inherited from​

JointNode.findChildById


findChildByName​

▸ findChildByName(name): undefined | Node

Finds and returns the first child node with the given name.

Parameters​

NameTypeDescription
namestringThe CoreObject.name of the child to search for.

Returns​

undefined | Node

The first child with the given name or undefined if no such child exists.

Inherited from​

JointNode.findChildByName


findDescendantById​

▸ findDescendantById(id): undefined | Node

Finds and returns the descendant with the given id.

Parameters​

NameTypeDescription
idstringThe CoreObject.id of the descendant to search for.

Returns​

undefined | Node

The descendant with the given id or undefined if no such descendant exists.

Inherited from​

JointNode.findDescendantById


findSceneAssetById​

▸ findSceneAssetById(id): undefined | Asset

Finds and returns the asset specified by the given id. Note that the node needs to be parented to a Scene for this method to work.

Parameters​

NameTypeDescription
idstringThe id of the asset to search for.

Returns​

undefined | Asset

The matched Asset of undefined if no such asset exists in the scene.

Inherited from​

JointNode.findSceneAssetById


findSceneAssetByName​

▸ findSceneAssetByName(name): undefined | Asset

Finds and returns the asset specified by the given name. Note that the node needs to be parented to a Scene for this method to work. Asset names are not unique, so if more than one asset shares the given name the first match is returned.

Parameters​

NameTypeDescription
namestringThe name of the asset to search for.

Returns​

undefined | Asset

The matched Asset or undefined if no such asset exists in the scene.

Inherited from​

JointNode.findSceneAssetByName


findSceneNode​

▸ findSceneNode(): undefined | Node

Uses the Node.findAncestorByClassName to find the Scene that this node is added to. If this node has not yet been added to a scene then this method will return undefined.

Returns​

undefined | Node

Inherited from​

JointNode.findSceneNode


fromScreen​

▸ fromScreen(position, from?, skipUpdate?): IPointData

Parameters​

NameType
positionIPoint
from?Node
skipUpdate?boolean

Returns​

IPointData

Inherited from​

JointNode.fromScreen


getAncestors​

▸ getAncestors(): Node[]

Returns the ancestors of this node

Returns​

Node[]

Inherited from​

JointNode.getAncestors


getAssetIds​

▸ getAssetIds(): string[]

Returns the ids of the assets that are used by this Node.

Returns​

string[]

The ids of the assets that are used by this Node.

Inherited from​

JointNode.getAssetIds


getBodyNodeA​

▸ getBodyNodeA(): undefined | BodyNode

Returns the BodyNodeA of this JointNode (which might be undefined)

Returns​

undefined | BodyNode

Inherited from​

JointNode.getBodyNodeA


getBodyNodeB​

▸ getBodyNodeB(): undefined | BodyNode

Returns the BodyNodeB of this JointNode (which might be undefined)

Returns​

undefined | BodyNode

Inherited from​

JointNode.getBodyNodeB


getBoundingRect​

▸ getBoundingRect(): Rectangle

Returns the bounding rectangle of this node in local coordinates.

The default implementation returns the local bounds of the underlying PIXI container but subclasses can re-implement this method to return their custom bounding rectangle.

Returns​

Rectangle

Overrides​

JointNode.getBoundingRect


getDependencies​

▸ getDependencies(): Node[]

Returns the nodes this node depends on. If this node is not added to a [[Scene]] then an empty array will be returned.

Returns​

Node[]

Array of nodes this node depends on.

Inherited from​

JointNode.getDependencies


getDependencyIds​

▸ getDependencyIds(): string[]

Returns the IDs of all nodes this node depends on. Subclasses that have dependencies (e.g. JointNode) should re-implement this method and return the IDs of the nodes that they depend on. The default implementation returns an empty array.

Returns​

string[]

Array of node IDs this node depends on.

Inherited from​

JointNode.getDependencyIds


getDependents​

▸ getDependents(): Node[]

Returns all Nodes that depend on this node. If this node is not added to a [[Scene]] then an empty array will be returned.

Returns​

Node[]

Array of Nodes that have this node as a dependency

Inherited from​

JointNode.getDependents


getDescendants​

▸ getDescendants(reversed?): Node[]

Returns the descendants of this node.

A descendant is node that has this node as an ancestor. Consider for example the following tree of nodes:

  • NodeA
    • NodeB
      • NodeD
      • NodeE
    • NodeC

If we ask for the descendants of NodeA we'll get back: [NodeB, NodeD, NodeE, NodeC]

If reversed is set to true then this method will return the reversed descendants. For the example above, that would be: [NodeC, NodeE, NodeD, NodeB, NodeA]. Note that the first item of the reversed descendants has the highest z-index.

Parameters​

NameTypeDefault value
reversedbooleanfalse

Returns​

Node[]

A list of this node's descendants

Inherited from​

JointNode.getDescendants


getDescendantsMap​

▸ getDescendantsMap(): Map<string, Node>

Returns a map of all descendants keyed by their IDs.

This provides efficient lookup of any descendant node by its ID without having to traverse the tree multiple times.

Returns​

Map<string, Node>

A Map where keys are node IDs and values are the corresponding Node objects

Inherited from​

JointNode.getDescendantsMap


getExtras​

▸ getExtras(): any

Returns any extra data that this object needs to save during serialization.

In some cases an object might need to save some extra data without necessarily this extra data being part of its state (e.g. the AssetsLibrary of a Scene). In these cases subclasses can re-implement this method and return the data required.

The default implementation returns undefined meaning that no extra data needs to be saved during serialization.

Returns​

any

Inherited from​

JointNode.getExtras


getFilteredDescendants​

▸ getFilteredDescendants<T>(cls): T[]

Returns the descendants of this node that are instances of the class cls

Type parameters​

NameType
Textends Node

Parameters​

NameType
clsConstructor<T>

Returns​

T[]

Inherited from​

JointNode.getFilteredDescendants


getFilteredDescendantsByClassName​

▸ getFilteredDescendantsByClassName(className): Node[]

Returns the descendants of this node that are instances of the class className

Parameters​

NameType
classNamestring

Returns​

Node[]

Inherited from​

JointNode.getFilteredDescendantsByClassName


getLocalTransform​

▸ getLocalTransform(): Matrix

Returns a copy of this node's (local) transformation matrix.

Returns​

Matrix

Inherited from​

JointNode.getLocalTransform


getNodeScript​

▸ getNodeScript(id): undefined | NodeScript

Returns the NodeScript that corresponds to the given id.

Parameters​

NameType
idstring

Returns​

undefined | NodeScript

Inherited from​

JointNode.getNodeScript


getNodeScriptByClassName​

▸ getNodeScriptByClassName(className): undefined | NodeScript

Parameters​

NameType
classNamestring

Returns​

undefined | NodeScript

Deprecated

Use getNodeScriptsByClassName instead. Kept for backward compatibility with old scenes.

Inherited from​

JointNode.getNodeScriptByClassName


getNodeScripts​

▸ getNodeScripts(): NodeScript[]

Returns all NodeScripts of this Node, in the order of the script entries they belong to.

An entry that has no NodeScript is left out, so the result can be shorter than scripts.

Returns​

NodeScript[]

Inherited from​

JointNode.getNodeScripts


getNodeScriptsByClassName​

▸ getNodeScriptsByClassName(className): NodeScript[]

Returns all NodeScripts whose class name matches the given className.

Parameters​

NameType
classNamestring

Returns​

NodeScript[]

Inherited from​

JointNode.getNodeScriptsByClassName


getPosition​

▸ getPosition(): IPoint

Convenience method which returns the node's position as a x,y object

Returns​

IPoint

Inherited from​

JointNode.getPosition


getReactionForce​

▸ getReactionForce(inv_dt): undefined | IPoint

Returns the reaction force given the inverse time step. Unit is N.

Parameters​

NameType
inv_dtnumber

Returns​

undefined | IPoint

Inherited from​

JointNode.getReactionForce


getReactionTorque​

▸ getReactionTorque(inv_dt): undefined | number

Returns the reaction torque given the inverse time step. Unit is N*m.

Parameters​

NameType
inv_dtnumber

Returns​

undefined | number

Inherited from​

JointNode.getReactionTorque


getSceneAngle​

▸ getSceneAngle(): number

Returns the Node's angle in Scene coordinates.

Returns​

number

Inherited from​

JointNode.getSceneAngle


getSceneBoundingRect​

▸ getSceneBoundingRect(): Rectangle

Returns​

Rectangle

Inherit Doc

that because joint nodes are defined in world (scene) coordinates, their sceneBoundingRect is always the same as their bounding rectangle.

Inherited from​

JointNode.getSceneBoundingRect


getScenePosition​

▸ getScenePosition(): IPoint

Returns the Node's position in Scene coordinates.

Returns​

IPoint

Inherited from​

JointNode.getScenePosition


getScenePositionAndAngle​

▸ getScenePositionAndAngle(): Object

Returns the Node's position and angle in Scene coordinates (optimized).

Returns​

Object

NameType
anglenumber
positionIPoint

Inherited from​

JointNode.getScenePositionAndAngle


getSceneTransform​

▸ getSceneTransform(): Matrix

Returns a copy of this node's scene transformation matrix. Use this matrix to map coordinates from this node's local coordinate system to the scene's coordinate system. To map coordinates from the scene, you must first invert the returned matrix.

Unlike getLocalTransform(), which returns only the local transformation, this function includes the node's (and any parents') position, and all the transfomation properties.

Returns​

Matrix

Inherited from​

JointNode.getSceneTransform


getShape​

▸ getShape(): Polygon

Returns the shape of this Node in local coordinates.

Note that the returned shape might be empty.

The shape of a Node is used for many things, including boolean operations and selection.

The default implementation calls getBoundingRect() to return a simple rectangular shape, but subclasses can reimplement this function to return a more accurate shape for non-rectangular items.

Returns​

Polygon

Overrides​

JointNode.getShape


getSnapPoints​

▸ getSnapPoints(snapMode): ISnapPoint[]

Snap Points

Parameters​

NameType
snapModenumber

Returns​

ISnapPoint[]

Inherited from​

JointNode.getSnapPoints


getState​

▸ getState(minified?): any

Returns this object's state

The object's state is an object containing key/value pairs corresponding to this object's properties. For example:

{
id: "Ssba4ch5ruok",
name: "Circle",
radius: 2,
// ...
}

To avoid including properties that are currently in their default value you can set minified = true when calling getState.

Note that read-only properties are not part of the object's state (with the exception of the id)

Parameters​

NameTypeDefault valueDescription
minifiedbooleanfalseWhether to return a minified state or not

Returns​

any

Inherited from​

JointNode.getState


getTransformedShape​

▸ getTransformedShape(): Polygon

Returns the shape of this Node in scene coordinates.

Note that the returned shape might be empty.

Returns​

Polygon

Inherited from​

JointNode.getTransformedShape


getWorldAnchor​

▸ getWorldAnchor(which): undefined | IPoint

Gets the world anchor point for the specified anchor (A or B) of this joint. The world anchor represents the global position where the joint is attached to the corresponding body in world coordinates.

Parameters​

NameType
whichAnchor

Returns​

undefined | IPoint

Inherited from​

JointNode.getWorldAnchor


getWorldAnchorA​

▸ getWorldAnchorA(): undefined | IPoint

Returns the "world anchor A" of this JointNode (which might be undefined)

Returns​

undefined | IPoint

Inherited from​

JointNode.getWorldAnchorA


getWorldAnchorB​

▸ getWorldAnchorB(): undefined | IPoint

Returns the "world anchor B" of this JointNode (which might be undefined)

Returns​

undefined | IPoint

Inherited from​

JointNode.getWorldAnchorB


hasDependencies​

▸ hasDependencies(): boolean

Returns true if this node has dependencies, otherwise returns false.

Returns​

boolean

Inherited from​

JointNode.hasDependencies


index​

▸ index(): number

Returns the index of this Node relatively to its parent. If this Node has no parent then -1 is returned.

Returns​

number

Inherited from​

JointNode.index


initGraphicsNode​

▸ initGraphicsNode(x, y, angle, lineStyle?, fillStyle?): void

Parameters​

NameType
xnumber
ynumber
anglenumber
lineStyle?LineStyle
fillStyle?FillStyle

Returns​

void

Inherited from​

JointNode.initGraphicsNode


initNode​

▸ initNode(x?, y?, angle?): void

Convenience method for setting node's Node.x, Node.y and Node.angle

Parameters​

NameTypeDefault value
xnumber0
ynumber0
anglenumber0

Returns​

void

Inherited from​

JointNode.initNode


insertChild​

▸ insertChild(child, index): boolean

Parameters​

NameType
childNode
indexnumber

Returns​

boolean

Inherited from​

JointNode.insertChild


insertChildren​

▸ insertChildren(children, index): void

Convenience method for inserting multiple children into this node at the specified index.

Parameters​

NameType
childrenNode[]
indexnumber

Returns​

void

Inherited from​

JointNode.insertChildren


isDestroyed​

▸ isDestroyed(): boolean

Returns true if this node has been destroyed via destroy(). A destroyed Node should not be used.

Returns​

boolean

Inherited from​

JointNode.isDestroyed


isSelected​

▸ isSelected(): boolean

Returns true if this node is currently selected.

Returns​

boolean

Inherited from​

JointNode.isSelected


move​

▸ move(d): void

Moves this node by the given d.x, d.y

Parameters​

NameType
dIPoint

Returns​

void

Inherited from​

JointNode.move


removeAllChildren​

▸ removeAllChildren(): void

Convenience method which removes all children of this node

Returns​

void

Inherited from​

JointNode.removeAllChildren


removeChild​

▸ removeChild(child): boolean

Parameters​

NameType
childNode

Returns​

boolean

Inherited from​

JointNode.removeChild


removeChildren​

▸ removeChildren(children): void

Convenience method for removing multiple children from this node.

Parameters​

NameType
childrenNode[]

Returns​

void

Inherited from​

JointNode.removeChildren


removeScript​

▸ removeScript(id): boolean

Removes a script from this node.

Convenience wrapper around the scripts property: it drops the matching entry and reassigns the array.

Parameters​

NameTypeDescription
idstringThe id of the script entry to remove.

Returns​

boolean

true if a script was removed, false if this node has no such script.

Inherited from​

JointNode.removeScript


reorderChild​

▸ reorderChild(child, newIndex): boolean

Moves a child node to a different position (order) among the other children If the operation is successul then the EVT_CHILD_REORDERED signal will be emitted

Parameters​

NameTypeDescription
childNodeThe child node to be moved
newIndexnumberThe new index where the child node will be moved

Returns​

boolean

true on success otherwise false

Inherited from​

JointNode.reorderChild


setExtras​

▸ setExtras(_x): boolean

Sets any extra data that this object needs during de-serialization.

Returns true on success, otherwise returns false.

The default implementation does nothing and returns true.

Parameters​

NameType
_xany

Returns​

boolean

Inherited from​

JointNode.setExtras


setFlag​

▸ setFlag(flag, on?): void

Parameters​

NameTypeDefault value
flagCoreObjectFlagsundefined
onbooleantrue

Returns​

void

Inherited from​

JointNode.setFlag


setPosition​

▸ setPosition(v): void

Convenience method for setting the node's position to the given x,y

Parameters​

NameType
vIPoint

Returns​

void

Inherited from​

JointNode.setPosition


setScenePosition​

▸ setScenePosition(v): void

Sets the Node's scene position.

Parameters​

NameType
vIPoint

Returns​

void

Inherited from​

JointNode.setScenePosition


setState​

▸ setState(state, updateId?): boolean

Sets the object's state

Parameters​

NameTypeDefault valueDescription
stateanyundefinedThe state to be set
updateIdbooleantrueWhether to also update the id property

Returns​

boolean

True on success otherwise false

Inherited from​

JointNode.setState


testFlag​

▸ testFlag(flag): boolean

Parameters​

NameType
flagCoreObjectFlags

Returns​

boolean

Inherited from​

JointNode.testFlag


toGlobal​

▸ toGlobal(position): Point

Parameters​

NameType
positionIPoint

Returns​

Point

Inherited from​

JointNode.toGlobal


toLocal​

▸ toLocal(position): Point

Parameters​

NameType
positionIPoint

Returns​

Point

Inherited from​

JointNode.toLocal


toScreen​

▸ toScreen(position, skipUpdate?): IPointData

Parameters​

NameType
positionIPoint
skipUpdate?boolean

Returns​

IPointData

Inherited from​

JointNode.toScreen


update​

▸ update(delta): void

Updates this node.

The default update will do the following:

  • It will call the update method for all NodeScripts attached to this node
  • Advance the visual filters that animate, see VisualFiltersMixin.update
  • Call update for each child of this node.

Children are iterated over a shallow copy of _children, not the live array, since a NodeScript's update() may insert/remove siblings on this node (e.g. Breakable spawning fragments); iterating the live array would skip or double-visit siblings shifted by those mutations.

Parameters​

NameTypeDescription
deltanumberThe fixed simulation step, in milliseconds

Returns​

void

Inherited from​

JointNode.update