File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
packages/dev/core/src/Physics/v2 Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ export interface IPhysicsEnginePluginV2 {
123123 // body
124124 initBody ( body : PhysicsBody , position : Vector3 , orientation : Quaternion ) : void ;
125125 initBodyInstances ( body : PhysicsBody , mesh : Mesh ) : void ;
126+ updateBodyInstances ( body : PhysicsBody , mesh : Mesh ) : void ;
126127 removeBody ( body : PhysicsBody ) : void ;
127128 sync ( body : PhysicsBody ) : void ;
128129 syncTransform ( body : PhysicsBody , transformNode : TransformNode ) : void ;
Original file line number Diff line number Diff line change @@ -84,6 +84,16 @@ export class PhysicsBody {
8484 physicsEngine . addBody ( this ) ;
8585 }
8686
87+ /**
88+ * If a physics body is connected to an instanced node, update the number physic instances to match the number of node instances.
89+ */
90+ public updateBodyInstances ( ) {
91+ const m = this . transformNode as Mesh ;
92+ if ( m . hasThinInstances ) {
93+ this . _physicsPlugin . updateBodyInstances ( this , m ) ;
94+ }
95+ }
96+
8797 /**
8898 * Sets the shape of the physics body.
8999 * @param shape - The shape of the physics body.
You can’t perform that action at this time.
0 commit comments