Answers for "how to move towards an object unity"

C#
7

how to move towards an object unity

//This will work for 2d or 3d platforms
//Make sure to call in Update or else it wont work
Vector3.MoveTowards(transform.position, taretPos, Qiaternion.identiy)
Posted by: Guest on January-06-2020
4

move towards target unity

/// <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

Code answers related to "how to move towards an object unity"

C# Answers by Framework

Browse Popular Code Answers by Language