- Home /
Question by
KloverGames · Mar 15, 2021 at 04:58 PM ·
rotationraycasttransformposition
How to make a gameobject rotation equal to ray transform?
So I want the gun to rotate and sort of look at the where the ray is pointing. Here is my code:
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
gun.LookAt(???);// I want the gun to look around and follow the ray position
if (Input.GetMouseButton(0))
{
raycastPointer.position = Input.mousePosition;//Raycast pointer tracks the ray position on the canvas
}
Comment