# i want that to move keep going of angle direction.

I know the angle that between point A and point B and used.

``````// angle point a from to point b
float minusX = touchPosition.x - playerPosition.x;
float minusY = touchPosition.y - playerPosition.y;
mAngle = Mathf.Atan2(minusX, minusY) * Mathf.Rad2Deg;﻿
``````

question:

i want that to move keep going of angle direction.

oh, i used moveTo function in itween.

like this :

``````  iTween.MoveTo(gameObject, iTween.Hash(
"position", endPosition,
"easeType", iTween.EaseType.linear,
"time", .5f,
"islocal", true,
"onComplete", "selfDestory",
"onCompleteTarget", gameObject
))
``````

;

i must using that endPosition. how to get endposition.

For most uses of Mathf.Atan2() it would be called with Mathf.Atan2(minusY, minusX). I.e. the parameters reversed from what you have here. The only time I’ve seen them reversed is when looking at the winding of the situation backwards.

As for calculating the MoveTo() position, typically it would be done this way:

``````endPosition = playerPosition + (toushPosition - playerPosition).normalized * distance;
``````

Note that ‘distance’ is the distance away from ‘playerPosition’ to calculate the end point. I have a bit of concern here based on your variable names. Typically touchPosition is in Screen coordinates and a player’s position would be in World coordinates. touchPosition would need to be translated into World coordinates for this code (your angle code or using the code I provided to calculate the ‘enePosition’) to work.