Hello, I was wondering if there is any way to stop a sprite from moving using transform.translate, because working with rigidbody velocity is proving challenging. For Example, if the sprite enters a collision and is being moved is there a way to stop it without using velocity? I have already tried transform.translate(0,0,0) and it doesn’t work.
1 Answer
1Well I figured it out. All I needed was boolean to say whether or not my character should move, and then added that condition to my movement if statements.
Is the sprite being moved by rigidbody physics? If so, the easiest way to stop the object from moving would be to set the rigidbody's velocity to 0. transform.Translate(0,0,0) does nothing regardless; if you needed to stop an object moving that way you would need to change your actual movement function.
– Namey5