Home > database >  How to freeze position for a time
How to freeze position for a time

Time:04-25

sorry for my English, I'm new in C#. I created a script in which I teleport the ball, but when the ball is teleported, it retains its speed. How can I stop the ball for a while after teleporting. I tried to do it using bool "isTeleported" and if (isTeleported == true){rigidbody.constraints = RigidbodyConstraints.FreezePosition;} It didn't work. . Thanks in advance for your reply.

CodePudding user response:

Take a look at this: https://docs.unity3d.com/ScriptReference/Rigidbody-velocity.html

You could just set your rigidbody.velocity to a vector3.zero.

rigidbody.velocity = Vector3.zero;
  • Related