- Home /
user input azimuth and elevation angle. Need Urgent Help
Hi Members, I want user input of azimuth and elevation angle for a specific game abject. and game object should move in to that user inputed angles of elevation and azimuth. I know how to find the azimuth and elevation angle beteen two objects but know i want user should input those angles and object move to those input angles. Furthermore i also attatced my game scene. Green cube is a gameobject i want to move by user input angles, For calculating Azimuth and elevation angle i'using the following code.
for azimuth
Vector3 direction = transform.InverseTransformDirection ((target.position-transform.position)); float azimuth = Mathf.Atan2 (direction.z, direction.x) * Mathf.Rad2Deg;
For Elevation
float elevation = Mathf.Atan2 (direction.y, Mathf.Sqrt(direction.x*direction.x+direction.z*direction.z)) * Mathf.Rad2Deg;
How can i write C# for this user input angles Scenerio. Would be very very thank full if any person can help me out. thanks !
[1]: /storage/temp/108070-game.png