Stop movement on mouse interaction
Hi there, i've made some movement scripts which are working great but one of my moving objects is a 2d circle collider/rigid body. After it starts moving even once it stops it will keep spinning, I can watch the y/x center numbers changing constantly in the circle collider 2d section for about 5 seconds and then finally stop. I don't want to increase the friction or drag as they are at very comfortable numbers for general movement.
How would I go about instantly stopping all movement on mouse down? My game mechanic is somewhat reliant on no movement whilst aiming, and the constant spinning is making aiming impossible unless you wait the 5 seconds for it to naturally stop. Thanks so much in advance!!
Answer by Cuttlas-U · Apr 29, 2020 at 05:45 AM
hey ; u can use :
Rigidbody2d.velocity = vector2.Zero;
and it will set its movement to 0 on all axis;
Your answer
Follow this Question
Related Questions
Sprite 2d passes through the ground 0 Answers
Object Colliding while passing along another object . 0 Answers
Rigidbody projectile misses collider 1 Answer
How do I find if a 2D collider is overlapping with another 2D collider, rather than just touching? 0 Answers
OnCollisionEnter 2d not working 0 Answers