Capítulo 506 de 859

Chapter 506: UserDataNode

Core Idea

A special type of reference node that allows to link values in userData fields to node objects.

Since UserDataNode is extended from ReferenceNode, the node value will automatically be updated when the rotation user data field changes.

Key Concepts

  • userData : Object: A reference to the userData object. If not provided, the userData property of the 3D object that uses the node material is evaluated.

Code Examples

sprite.userData.rotation = 1; // stores individual rotation per sprite
const material = new THREE.SpriteNodeMaterial();
material.rotationNode = userData( 'rotation', 'float' );
  • What it demonstrates: Typical usage of UserDataNode.

Reference Tables

Constructor

Signature
new UserDataNode( property : string, inputType : string, userData : Object )

Properties

PropertyDescription
.userData : ObjectA reference to the userData object. If not provided, the userData property of the 3D object that uses the node material is evaluated.

Methods

MethodDescription
`.updateReference( state : NodeFrameNodeBuilder ) : Object`

Key Takeaways

  1. UserDataNode extends: EventDispatcher → Node → ReferenceNode
  2. Most relevant properties: userData.
  3. Key methods: updateReference.

Connects To