Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Vector3 offset from where it should be pointing ?

$
0
0
So what i'm trying to do is make a field of view for my enemy using a Vector3.Angle. I have 1 vector pointing directly in front of the enemy, and the other pointing at the player, except what i'm noticing is the one pointing at the player is not directly pointing at it its back a bit. I don't know if i typed something wrong which I don't think I did, so feel free to let me know if i screwed up. //Ray pointing directly in front of the enemy Debug.DrawRay(transform.position + new Vector3(0, 2, 0), transform.TransformDirection(Vector3.forward), Color.red); //Ray pointing to the enemy while ignoring the y axis Debug.DrawRay(transform.position + new Vector3(0, 2, 0), Enemy.transform.position - new Vector3(0, Enemy.transform.position.y, 0), Color.blue); //A log showing the angle in degrees that is created Debug.Log(Vector3.Angle(transform.position + new Vector3(0, 2, 0), Enemy.transform.position - new Vector3(0, Enemy.transform.position.y, 0))); ![alt text][1] [1]: /storage/temp/69182-screenshot-1.png

Viewing all articles
Browse latest Browse all 7934

Latest Images

Trending Articles



Latest Images

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