Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How do i rotate it around Y?

$
0
0
I need to rotate spaceship tower(like a tank tower), but i need to keep Z and X empty. var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { var eulers = transform.eulerAngles; Vector3 targetPoint = hit.point; var targetRotation = Quaternion.LookRotation(targetPoint - transform.position); Debug.Log(transform.eulerAngles); transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, 2f * Time.deltaTime); eulers = new Vector3(0, eulers.y, 0); transform.eulerAngles = eulers;

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>