How to stop the entity with dynamic rigibody?


I use this to make the ball moving in update function:

this.entity.rigidbody.linearVelocity = this._velocity;

Then, I use this.entity.rigidbody.teleport(this.initX, this.initY, this.initZ) to reset the ball’s position when game reset.

Unfortunately, the ball is still moving. Here’s my question.

How to stop the ball when reseting the game? Is there any way to remove the inertance of the ball ?

Thank you for your time !

eh, I found this opportunistic way :

:grin: :grin: :grin:

Heh, that’s a little overkill as it probably makes all kinds of changes and re-creates the physics body.

Simplest way to reset is:

this.entity.rigidbody.linearVelocity = pc.Vec3.ZERO;
this.entity.rigidbody.angularVelocity = pc.Vec3.ZERO;

ah, at the first time, I just set the linearVelocity to pc.Vec3.ZERO. I ignored the angularVelocity. :stuck_out_tongue_closed_eyes: Thank you, dave.