internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider) { if (collider.Shape is ConcavePolygonShape concavePolygonShape) { Patch(app, concavePolygonShape); } }
internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider) { if (collider.Shape is CylinderShape cylinderShape) { Vector3 newCenter = Vector3.Zero; Basis basis = Basis.Identity; if (Center != null) { newCenter.x = Center.X; newCenter.y = Center.Y; newCenter.z = Center.Z; } if (Dimensions != null) { float radius; float height; if (Mathf.IsEqualApprox(Dimensions.X, Dimensions.Y)) { height = Dimensions.Z; radius = Dimensions.X / 2; } else if (Mathf.IsEqualApprox(Dimensions.X, Dimensions.Z)) { height = Dimensions.Y; radius = Dimensions.X / 2; } else { height = Dimensions.X; radius = Dimensions.Y / 2; } cylinderShape.Radius = radius; cylinderShape.Height = height; if (Dimensions.X == height) { basis = basis.Rotated(Vector3.Forward, Mathf.Pi / 2); } else if (Dimensions.Z == height) { basis = basis.Rotated(Vector3.Right, Mathf.Pi / 2); } } collider.Transform = new Transform(basis, newCenter); } }
internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider) { if (collider.Shape is SphereShape sphereCollider) { if (Center != null) { Vector3 newCenter; newCenter.x = Center.X; newCenter.y = Center.Y; newCenter.z = Center.Z; collider.Transform = new Transform(Basis.Identity, newCenter); } if (Radius != null) { sphereCollider.Radius = Radius.Value; } } }
internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider) { if (collider.Shape is BoxShape boxShape) { if (Center != null) { Vector3 newCenter; newCenter.x = Center.X; newCenter.y = Center.Y; newCenter.z = Center.Z; collider.Transform = new Transform(Basis.Identity, newCenter); } if (Size != null) { Vector3 newSize; newSize.x = Size.X; newSize.y = Size.Y; newSize.z = Size.Z; boxShape.Extents = newSize; } } }
internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider) { // We do not accept patching for auto colliders from the app. }
internal abstract void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider);