示例#1
0
        public void SphereIntersectsBox_AA(float x, float y, float width, float height, float boxHeight, bool expected)
        {
            var sphere = new SphereCollider(new Transform(Vector3.Zero, Quaternion.Identity), 1);
            var box    = new BoxCollider(new RectangleF(x, y, width, height), boxHeight);

            Assert.Equal(expected, sphere.Intersects(box));
        }
示例#2
0
        public void SphereIntersectsSphere(float x, float y, float z, float radius, bool expected)
        {
            var sphere  = new SphereCollider(new Transform(Vector3.Zero, Quaternion.Identity), 1);
            var sphere2 = new SphereCollider(new Transform(new Vector3(x, y, z), Quaternion.Identity), radius);

            Assert.Equal(expected, sphere.Intersects(sphere2));
        }
示例#3
0
        public void SphereColliderIntersectsRay(float x, float y, float z, float dirX, float dirY, float dirZ, bool expected, float expectedDepth)
        {
            var sphere = new SphereCollider(new Transform(Vector3.Zero, Quaternion.Identity), 1);
            var ray    = new Ray(new Vector3(x, y, z), new Vector3(dirX, dirY, dirZ));

            Assert.Equal(expected, sphere.Intersects(ray, out var depth));
            Assert.Equal(expectedDepth, depth);
        }