computeBoundingBox method
void
computeBoundingBox()
override
Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}. The bounding box is not automatically computed by the engine; this method must be called by your app. If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect the current animation state.
Implementation
void computeBoundingBox() {
final geometry = this.geometry;
if ( this.boundingBox == null ) {
this.boundingBox = new BoundingBox();
}
this.boundingBox?.empty();
final positionAttribute = geometry?.getAttributeFromString( 'position' );
for (int i = 0; i < positionAttribute.count; i ++ ) {
this.getVertexPosition( i, _vertex );
this.boundingBox?.expandByPoint( _vertex );
}
}