示例#1
0
 internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider)
 {
     if (collider.Shape is ConcavePolygonShape concavePolygonShape)
     {
         Patch(app, concavePolygonShape);
     }
 }
示例#2
0
        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);
            }
        }
示例#3
0
        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;
                }
            }
        }
示例#4
0
        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;
                }
            }
        }
示例#5
0
 internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider)
 {
     // We do not accept patching for auto colliders from the app.
 }
示例#6
0
 internal abstract void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider);