- Home /
Question by
kyodi5clay · Feb 17 at 02:15 AM ·
guns
I am tryong to make a wepon look at the point, but there are some issues. I'd like to clamp the minimum point where the gun can face. How do i do that?
my code //check if ray hits something Vector3 targetPoint; if (Physics.Raycast(ray, out hit)) targetPoint = hit.point; else if (Vector3.Distance(hit.point, fpsCam.transform.position) > 100f) targetPoint = ray.GetPoint(40); else targetPoint = ray.GetPoint(400); //Just a point far away from the player gun.transform.LookAt(targetPoint);
Here is an image of the clipping
Thank you!
1.png
(271.7 kB)
Comment
Your answer
Follow this Question
Related Questions
Switching my weapons 2 Answers
My automatic gun don't work help! 1 Answer
How to change the damage my gun does? 1 Answer
How can I get the Guns to Shoot for PTGA Exercise Game? 0 Answers