Sprite shaking/ jittering/ jiggling/ wiggling/ vibrating when moving it using joystick (2D).
`using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public Joystick mJoystick; public float mRunSpeed = 2.0f; public GameObject Target; void FixedUpdate() { var currentDir2D = mJoystick.Direction.normalized; Target.transform.Translate(new Vector3(currentDir2D.x, currentDir2D.y, 0) * Time.deltaTime * mRunSpeed); } }
When using just the Update function, the same sort of movement is seen when bumping into walls. I tried changing it to FixedUpdate, which solved that issue, however now when simply controlling the sprite, moving it normally, the same sort of movement can be seen. I tried using the rigidbody.AddForce thing, and albeit solving my issues, makes the sprite move after letting go of the joystick (think of a car when you hit the acceleration pedal, then let go and but it still moves; inertia). What should I do to achieve clean movement?
Your answer
Follow this Question
Related Questions
I need help with making a game over when an object interacts with a wall? 0 Answers
How to cancel the force caused by collision? So the player is not pushed away when it hits a corner? 0 Answers
Movement causing infinite loops in OnTriggerEnter and OnTriggerExit. 1 Answer
How to make rigidbody not effect movement while still using it for collisions? 0 Answers
C# 2D top down shooter game, How do I get the player to shoot towards the mouse cursor? 0 Answers