diff --git a/src/nodes/accessors/InstanceNode.js b/src/nodes/accessors/InstanceNode.js index 7ba8f36dabf080..716bc01da4cd26 100644 --- a/src/nodes/accessors/InstanceNode.js +++ b/src/nodes/accessors/InstanceNode.js @@ -76,6 +76,15 @@ class InstanceNode extends Node { */ this.instanceColorNode = null; + /** + * The update type is set to `frame` for updating + * velocity-related data. + * + * @type {string} + * @default 'frame' + */ + this.updateType = NodeUpdateType.FRAME; + /** * The update type is set to `frame` since an update * of instanced buffer data must be checked per frame. @@ -83,7 +92,7 @@ class InstanceNode extends Node { * @type {string} * @default 'frame' */ - this.updateType = NodeUpdateType.FRAME; + this.updateBeforeType = NodeUpdateType.FRAME; /** * A reference to a buffer that is used by `instanceMatrixNode`. @@ -220,7 +229,7 @@ class InstanceNode extends Node { * * @param {NodeFrame} frame - The current node frame. */ - update( frame ) { + updateBefore( /*frame*/ ) { if ( this.buffer !== null && this.isStorageMatrix !== true ) { @@ -250,6 +259,15 @@ class InstanceNode extends Node { } + } + + /** + * Updates velocity-related data if necessary. + * + * @param {NodeFrame} frame - The current node frame. + */ + update( frame ) { + if ( this.previousInstanceMatrixNode !== null ) { frame.object.previousInstanceMatrix.array.set( this.instanceMatrix.array );