From 996592eec3c7218335f5fc437bccd4ae49544b87 Mon Sep 17 00:00:00 2001 From: ikpil Date: Wed, 7 Jun 2023 23:40:05 +0900 Subject: [PATCH] for unity3d --- .../Tools/ColliderShape.cs | 13 ------- .../Tools/DynamicUpdateTool.cs | 38 +++++++++---------- .../DynamicColliderShape.cs | 14 +++++++ 3 files changed, 33 insertions(+), 32 deletions(-) delete mode 100644 src/DotRecast.Recast.Demo/Tools/ColliderShape.cs create mode 100644 src/DotRecast.Recast.DemoTool/DynamicColliderShape.cs diff --git a/src/DotRecast.Recast.Demo/Tools/ColliderShape.cs b/src/DotRecast.Recast.Demo/Tools/ColliderShape.cs deleted file mode 100644 index 426dd89..0000000 --- a/src/DotRecast.Recast.Demo/Tools/ColliderShape.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace DotRecast.Recast.Demo.Tools; - -public enum ColliderShape -{ - SPHERE, - CAPSULE, - BOX, - CYLINDER, - COMPOSITE, - CONVEX, - TRIMESH_BRIDGE, - TRIMESH_HOUSE -} \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs index 75370fd..323dbf9 100644 --- a/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/DynamicUpdateTool.cs @@ -73,8 +73,8 @@ public class DynamicUpdateTool : Tool private long buildTime; private long raycastTime; - private int colliderShapeIdx = (int)ColliderShape.SPHERE; - private ColliderShape colliderShape = ColliderShape.SPHERE; + private int colliderShapeIdx = (int)DynamicColliderShape.SPHERE; + private DynamicColliderShape colliderShape = DynamicColliderShape.SPHERE; private DynamicNavMesh dynaMesh; private readonly TaskFactory executor; @@ -113,35 +113,35 @@ public class DynamicUpdateTool : Tool Tuple colliderWithGizmo = null; if (dynaMesh != null) { - if (colliderShape == ColliderShape.SPHERE) + if (colliderShape == DynamicColliderShape.SPHERE) { colliderWithGizmo = SphereCollider(p); } - else if (colliderShape == ColliderShape.CAPSULE) + else if (colliderShape == DynamicColliderShape.CAPSULE) { colliderWithGizmo = CapsuleCollider(p); } - else if (colliderShape == ColliderShape.BOX) + else if (colliderShape == DynamicColliderShape.BOX) { colliderWithGizmo = BoxCollider(p); } - else if (colliderShape == ColliderShape.CYLINDER) + else if (colliderShape == DynamicColliderShape.CYLINDER) { colliderWithGizmo = CylinderCollider(p); } - else if (colliderShape == ColliderShape.COMPOSITE) + else if (colliderShape == DynamicColliderShape.COMPOSITE) { colliderWithGizmo = CompositeCollider(p); } - else if (colliderShape == ColliderShape.TRIMESH_BRIDGE) + else if (colliderShape == DynamicColliderShape.TRIMESH_BRIDGE) { colliderWithGizmo = TrimeshBridge(p); } - else if (colliderShape == ColliderShape.TRIMESH_HOUSE) + else if (colliderShape == DynamicColliderShape.TRIMESH_HOUSE) { colliderWithGizmo = TrimeshHouse(p); } - else if (colliderShape == ColliderShape.CONVEX) + else if (colliderShape == DynamicColliderShape.CONVEX) { colliderWithGizmo = ConvexTrimesh(p); } @@ -617,19 +617,19 @@ public class DynamicUpdateTool : Tool ImGui.Separator(); var prev = colliderShape; ImGui.Checkbox("Show", ref showColliders); - ImGui.RadioButton("Sphere", ref colliderShapeIdx, (int)ColliderShape.SPHERE); - ImGui.RadioButton("Capsule", ref colliderShapeIdx, (int)ColliderShape.CAPSULE); - ImGui.RadioButton("Box", ref colliderShapeIdx, (int)ColliderShape.BOX); - ImGui.RadioButton("Cylinder", ref colliderShapeIdx, (int)ColliderShape.CYLINDER); - ImGui.RadioButton("Composite", ref colliderShapeIdx, (int)ColliderShape.COMPOSITE); - ImGui.RadioButton("Convex Trimesh", ref colliderShapeIdx, (int)ColliderShape.CONVEX); - ImGui.RadioButton("Trimesh Bridge", ref colliderShapeIdx, (int)ColliderShape.TRIMESH_BRIDGE); - ImGui.RadioButton("Trimesh House", ref colliderShapeIdx, (int)ColliderShape.TRIMESH_HOUSE); + ImGui.RadioButton("Sphere", ref colliderShapeIdx, (int)DynamicColliderShape.SPHERE); + ImGui.RadioButton("Capsule", ref colliderShapeIdx, (int)DynamicColliderShape.CAPSULE); + ImGui.RadioButton("Box", ref colliderShapeIdx, (int)DynamicColliderShape.BOX); + ImGui.RadioButton("Cylinder", ref colliderShapeIdx, (int)DynamicColliderShape.CYLINDER); + ImGui.RadioButton("Composite", ref colliderShapeIdx, (int)DynamicColliderShape.COMPOSITE); + ImGui.RadioButton("Convex Trimesh", ref colliderShapeIdx, (int)DynamicColliderShape.CONVEX); + ImGui.RadioButton("Trimesh Bridge", ref colliderShapeIdx, (int)DynamicColliderShape.TRIMESH_BRIDGE); + ImGui.RadioButton("Trimesh House", ref colliderShapeIdx, (int)DynamicColliderShape.TRIMESH_HOUSE); ImGui.NewLine(); if ((int)prev != colliderShapeIdx) { - colliderShape = (ColliderShape)colliderShapeIdx; + colliderShape = (DynamicColliderShape)colliderShapeIdx; } } diff --git a/src/DotRecast.Recast.DemoTool/DynamicColliderShape.cs b/src/DotRecast.Recast.DemoTool/DynamicColliderShape.cs new file mode 100644 index 0000000..ebfca11 --- /dev/null +++ b/src/DotRecast.Recast.DemoTool/DynamicColliderShape.cs @@ -0,0 +1,14 @@ +namespace DotRecast.Recast.DemoTool +{ + public enum DynamicColliderShape + { + SPHERE, + CAPSULE, + BOX, + CYLINDER, + COMPOSITE, + CONVEX, + TRIMESH_BRIDGE, + TRIMESH_HOUSE + } +} \ No newline at end of file