# How to get new position of object based on start point, distance and angle?

How to get position based on start point, distance and angle?

Here is my implementation:

``````Vector3 GetObjectPosition(Vector3 startPoint, float distance, float angle)
{
Vector3 newPos = new Vector3 (startPoint.x, startPoint.y);
handObject.transform.Rotate (newPos, angle);
newPos = handObject.transform.forward * distance;

return newPos;
}
void Update ()
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mousePos.z = 0;
float angle = Vector2.Angle(this.transform.position, mousePos);

Vector3 handPos = UpdateHandPosition (this.transform.position, 10.0f, angle);
handObject.transform.position = handPos;
print (handPos);
}
``````

As result it blinks(moves very fast) and doesnâ€™t work properly

you can use SOH CAH TOA to get a direction vector, multiply it by distance then add it to startPoint

so your direction vector is something like `Vector2(x = Mathf.Cos(angle), y = Mathf.Sin(angle))`

Vector2 GetObjectPosition(Vector2 startPoint, float distance, float angle){

``````    transform point;  //i don't remember how to rotate a vector2 so i used a transform
point.position = startPoint;  //i'm sure there's a function to rotate a vector2
point.rotate(angle);  //now it's pointing to the desired new location

point.forward * distance;  //now walk forward that much of a distance
//transform.forward is shorthand for (1,0,0). If your distance is 1.5f, it'll be(1.5f, 0, 0)

return transform.point;

}
``````