Supermarket.Supermarket.RandomPosition C# (CSharp) Méthode

RandomPosition() public méthode

Gets a random position within the supermarket that is on the supermarket navmesh
public RandomPosition ( ) : Vector3
Résultat UnityEngine.Vector3
        public Vector3 RandomPosition()
        {
            // Random position on supermarket floor
            Vector3 randomLocation = new Vector3(Random.Range(minFloorBounds.x, maxFloorBounds.x), 0, Random.Range(minFloorBounds.z, maxFloorBounds.z));

            // Adjusting the random position to be on the navmesh
            NavMeshHit hit;
            NavMesh.SamplePosition(randomLocation, out hit, 20.0f, 1);
            return hit.position;
        }