Scene

This module is a high level scene graph manipulation and query library.

Scene

  • Either id, name, or regex's can be used for node names.
  • All get functions return the value, or undefined if no match is found
  • All find functions return an id or a Path
  • All filter functions return an array of id or Path

getAll

Finds all nodes.

player.scene.getAll()

find(query)

Finds first matching node.
Kind: inner method of Scene

parametertypedescription
queryQueryObjectThe query object to filter on.
// Return the node uuid
player.scene.find({ name: 'Box' }); //  -> ['uuid']
// Return the path to the transform operator
player.scene.find({ name: 'Box', plug: 'Transform', property: 'translation' });// -> ['uuid','plugs','Transform',0]
// Match the first node that starts with Box
player.scene.find({ name: 'Box*' });

fetch(id)

Fetch an asset, to make it available for querying sceneGraph data.
Kind: inner method of Scene

parametertypedescription
idstringAsset ID to fetch

alignNode(nodeId, alignNodeId)

Move nodeId to align with alignNodeId, optionally using anchorNodeId to do the alignment.
Kind: inner method of Scene

parametertypedescription
nodeIdstringThe node that will be aligned.
alignNodeIdstringThe node nodeId will align with.
options.anchorNodeIdstringOptionally, the child of nodeId that will be aligned with alignNodeId. If left undefined, nodeId itself will be aligned to alignNodeId.
options.withRotationbooleanDefault is false. When set to true, both position and rotation of alignNodeId and anchorNodeId will be same after alignment.
// Move the sword to place the sword handle in the hand
player.scene.alignNode(swordId, handId, { anchorNodeId: swordHandleId, withRotation: true });