public static bool GetGroundInfoNavMesh(Vector3 startPos, out Vector3 pos, float maxVariationFallback, int acceptMask) { NavMeshHit navMeshHit; if (!TransformHelpers.GetGroundInfoNavMesh(startPos, out navMeshHit, maxVariationFallback, acceptMask)) { pos = startPos; return(false); } pos = navMeshHit.position; return(true); }
public GameObject SpawnGeneric(Spawns.SpawnerGeneric.SpawnInstance instance) { Vector3 startPos = this.Position + UnityEngine.Random.insideUnitSphere * this.SpawnRadius; startPos.y = this.Position.y; Quaternion quaternion = Quaternion.Euler(new Vector3(0f, (float)UnityEngine.Random.Range(0, 360), 0f)); Vector3 vector; if (instance.UseNavmeshSample && TransformHelpers.GetGroundInfoNavMesh(startPos, out vector, 15f, -1)) { startPos = vector; } Vector3 up; GameObject result; if (TransformHelpers.GetGroundInfoTerrainOnly(startPos, 300f, out vector, out up)) { vector.y += 0.05f; if (instance.PrefabName == "BoxLoot") { vector.y += 0.35f; } quaternion = TransformHelpers.LookRotationForcedUp(quaternion * Vector3.forward, up); GameObject gameObject; if (!instance.StaticInstantiate && !instance.PrefabName.StartsWith(";")) { gameObject = NetCull.InstantiateDynamic(instance.PrefabName, vector, quaternion); } else { gameObject = NetCull.InstantiateStatic(instance.PrefabName, vector, quaternion); } if (gameObject != null) { instance.Spawned.Add(gameObject); } result = gameObject; } else { result = null; } return(result); }
public static bool GetGroundInfoNavMesh(Vector3 startPos, out Vector3 pos) { return(TransformHelpers.GetGroundInfoNavMesh(startPos, out pos, 200f)); }
public static bool GetGroundInfoNavMesh(Vector3 startPos, out Vector3 pos, float maxVariationFallback) { return(TransformHelpers.GetGroundInfoNavMesh(startPos, out pos, maxVariationFallback, -1)); }