Question by
SuxoiKorm · Jun 03, 2018 at 02:10 PM ·
2dscripting problemspritemovement scriptmovements
Sprite mouse movement Unity2D
I tryed to move sprite that hited, but he's leaving the screen up.
if (Moving)
{
Vector2 mousePosition = Input.mousePosition;
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
HitedCar = hit.collider.gameObject;
HitedCar.transform.position = Vector2.MoveTowards(HitedCar.transform.position, mousePosition, 0.1f);
}
I found this code but it's not work
gif.gif
(194.0 kB)
Comment