Reconstruct lab story, interactions, patrol and jet pack practice flow
This commit is contained in:
1 parent
58424120bb
commit
c929f942e1
84 files changed
+7957
-305
No files matched your search
@@ -25,14 +25,22 @@ public sealed class SceneCollision
|
||||
public float DistanceSquared => Vector3.DistanceSquared(Capsule, Surface);
|
||||
}
|
||||
|
||||
public SceneCollision(Mesh mesh)
|
||||
public SceneCollision(Mesh mesh, bool wallsAndCeilingsOnly = false)
|
||||
{
|
||||
if (mesh.Indices.Length % 3 != 0) throw new ArgumentException("Collision indices must be triangles", nameof(mesh));
|
||||
if (wallsAndCeilingsOnly && mesh.CollisionPolygons.Length != mesh.Indices.Length / 3)
|
||||
throw new InvalidDataException("Original wall grid requires prepared source polygon normals");
|
||||
var result = new List<Triangle>();
|
||||
// Render visibility is not a proven collision mask. Original null-material
|
||||
// proxies remain present and block movement in this provisional policy.
|
||||
for (var i = 0; i < mesh.Indices.Length; i += 3)
|
||||
{
|
||||
// EXE4798B3 registers only stored normal.Y<.7 in the wall/ceiling
|
||||
// grid. Render normals and a recomputed cross product differ.
|
||||
if (wallsAndCeilingsOnly && mesh.CollisionPolygons[i / 3].Normal.Y >= .7f) continue;
|
||||
if (wallsAndCeilingsOnly && mesh.CollisionPolygons[i / 3].MaterialName is { } material
|
||||
&& (material.Equals("cstart", StringComparison.OrdinalIgnoreCase)
|
||||
|| material.Length == 7 && material.StartsWith("ccheck", StringComparison.OrdinalIgnoreCase) && material[6] is >= '1' and <= '9')) continue;
|
||||
if (mesh.Indices[i] >= mesh.Vertices.Length || mesh.Indices[i + 1] >= mesh.Vertices.Length
|
||||
|| mesh.Indices[i + 2] >= mesh.Vertices.Length)
|
||||
throw new ArgumentException("Collision index outside vertex table", nameof(mesh));
|
||||
|
||||
Reference in new issue
Block a user