Answers for "unity movetowards 2d"

C#
4

unity movetowards 2d

/// <summary>
/// Move 2D sprite towards target
/// </summary>
/// <param name="target"></param>
/// <param name="movementSpeed"></param>
private void Move(Vector3 target, float movementSpeed)
{
    //Move
    transform.position += (target - transform.position).normalized * movementSpeed * Time.deltaTime;
}
Posted by: Guest on May-03-2020

C# Answers by Framework

Browse Popular Code Answers by Language