Random.insideUnitSphere: 180° possible?
Hey there, instead of picking a random vector3 inside the unit sphere I want to pick a vector3 in only 180° in front of the player instead of the 360° that come with the Random.insideUnitySphere. It's for a random AI movement and I don't want the AI to walk in one direction and in the next frame in the opposite direction :D
Thank you
Comment
Are you sure that you want to use Random.insideUnitSphere? I am working on a solution, and i don't know, if you have to pick a random Vector3 inside a sphere, rather than a circle.
Best Answer
Answer by Eric5h5 · Jan 06, 2017 at 07:06 PM
var randomPoint = Random.insideUnitSphere;
randomPoint.z = Mathf.Abs (randomPoint.z);
randomPoint = transform.TransformPoint (randomPoint);
Your answer
Follow this Question
Related Questions
using Navmesh or ML Agent ?! 0 Answers
navmesh agent won't move on navmesh generated at runtime. 0 Answers