|
12 | 12 | using UnityEngine; |
13 | 13 | using DaggerfallWorkshop.Game.Entity; |
14 | 14 | using DaggerfallWorkshop.Game.MagicAndEffects; |
| 15 | +using DaggerfallWorkshop.Game.Utility; |
15 | 16 | using System.Collections.Generic; |
16 | 17 | using DaggerfallWorkshop.Utility; |
17 | 18 | using System.Linq; |
@@ -137,10 +138,10 @@ void Start() |
137 | 138 | (mobile.Enemy.HasRangedAttack1 && (!mobile.Enemy.CastsMagic || mobile.Enemy.HasRangedAttack2)); |
138 | 139 |
|
139 | 140 | // Add things AI should ignore when checking for a clear path to shoot. |
140 | | - ignoreMaskForShooting = ~(1 << LayerMask.NameToLayer("SpellMissiles") | 1 << LayerMask.NameToLayer("Ignore Raycast")); |
| 141 | + ignoreMaskForShooting = ~(1 << LayerMask.NameToLayer("SpellMissiles") | 1 << LayerMask.NameToLayer("Ignore Raycast") | 1 << LayerMask.NameToLayer("Automap")); |
141 | 142 |
|
142 | 143 | // Also ignore arrows and "Ignore Raycast" layer for obstacles |
143 | | - ignoreMaskForObstacles = ~(1 << LayerMask.NameToLayer("SpellMissiles") | 1 << LayerMask.NameToLayer("Ignore Raycast")); |
| 144 | + ignoreMaskForObstacles = ~(1 << LayerMask.NameToLayer("SpellMissiles") | 1 << LayerMask.NameToLayer("Ignore Raycast") | 1 << LayerMask.NameToLayer("Automap")); |
144 | 145 |
|
145 | 146 | LastGroundedY = transform.position.y; |
146 | 147 |
|
@@ -222,7 +223,7 @@ public Vector3 FindGroundPosition(float distance = 16) |
222 | 223 | { |
223 | 224 | RaycastHit hit; |
224 | 225 | Ray ray = new Ray(transform.position, Vector3.down); |
225 | | - if (Physics.Raycast(ray, out hit, distance)) |
| 226 | + if (Physics.Raycast(ray, out hit, distance, PhysicsLayers.DefaultRaycastLayersWithoutAutomap)) |
226 | 227 | return hit.point; |
227 | 228 |
|
228 | 229 | return transform.position; |
@@ -1188,7 +1189,7 @@ void ObstacleCheck(Vector3 direction) |
1188 | 1189 | p1 = transform.position + (Vector3.up * -originalHeight * 0.25f); |
1189 | 1190 | p2 = p1 + (Vector3.up * originalHeight * 0.75f); |
1190 | 1191 |
|
1191 | | - if (!Physics.CapsuleCast(p1, p2, controller.radius / 2, direction, checkDistance)) |
| 1192 | + if (!Physics.CapsuleCast(p1, p2, controller.radius / 2, direction, checkDistance, PhysicsLayers.DefaultRaycastLayersWithoutAutomap)) |
1192 | 1193 | { |
1193 | 1194 | ObstacleDetected = false; |
1194 | 1195 | foundUpwardSlope = true; |
@@ -1216,7 +1217,7 @@ void FallCheck(Vector3 direction) |
1216 | 1217 | Ray ray = new Ray(rayOrigin + direction, Vector3.down); |
1217 | 1218 | RaycastHit hit; |
1218 | 1219 |
|
1219 | | - fallDetected = !Physics.Raycast(ray, out hit, (originalHeight * 0.5f) + 1.5f); |
| 1220 | + fallDetected = !Physics.Raycast(ray, out hit, (originalHeight * 0.5f) + 1.5f, PhysicsLayers.DefaultRaycastLayersWithoutAutomap); |
1220 | 1221 | } |
1221 | 1222 |
|
1222 | 1223 | /// <summary> |
|
0 commit comments