Exemplo n.º 1
0
        public unsafe void RigidBodyCalculateAabb_SphereColliderTest()
        {
            Physics.RigidBody rigidbodySphere = Unity.Physics.RigidBody.Zero;
            const float       convexRadius    = 1.0f;

            rigidbodySphere.Collider = (Collider *)SphereCollider.Create(float3.zero, convexRadius).GetUnsafePtr();

            var sphereAabb = rigidbodySphere.CalculateAabb();
            var sphere     = (Collider *)SphereCollider.Create(float3.zero, convexRadius).GetUnsafePtr();

            Assert.IsTrue(sphereAabb.Equals(sphere->CalculateAabb()));
        }
Exemplo n.º 2
0
        public unsafe void RigidBodyCalculateAabb_BoxColliderTest()
        {
            Physics.RigidBody rigidbodyBox = Unity.Physics.RigidBody.Zero;
            const float       size         = 1.0f;
            const float       convexRadius = 0.2f;

            rigidbodyBox.Collider = (Collider *)BoxCollider.Create(float3.zero, quaternion.identity, new float3(size), convexRadius).GetUnsafePtr();

            var boxAabb = rigidbodyBox.CalculateAabb();
            var box     = (BoxCollider *)BoxCollider.Create(float3.zero, quaternion.identity, new float3(size), convexRadius).GetUnsafePtr();

            Assert.IsTrue(boxAabb.Equals(box->CalculateAabb()));
        }
Exemplo n.º 3
0
        public unsafe void RigidBodyCalculateAabb_SphereColliderTest()
        {
            var geometry = new SphereGeometry
            {
                Center = float3.zero,
                Radius = 1.0f
            };

            Physics.RigidBody rigidbodySphere = Unity.Physics.RigidBody.Zero;
            rigidbodySphere.Collider = (Collider *)SphereCollider.Create(geometry).GetUnsafePtr();

            var sphereAabb = rigidbodySphere.CalculateAabb();
            var sphere     = (Collider *)SphereCollider.Create(geometry).GetUnsafePtr();

            Assert.IsTrue(sphereAabb.Equals(sphere->CalculateAabb()));
        }
Exemplo n.º 4
0
        public unsafe void RigidBodyCalculateAabb_BoxColliderTest()
        {
            var geometry = new BoxGeometry
            {
                Center      = float3.zero,
                Orientation = quaternion.identity,
                Size        = 1.0f,
                BevelRadius = 0.2f
            };

            Physics.RigidBody rigidbodyBox = Unity.Physics.RigidBody.Zero;
            rigidbodyBox.Collider = (Collider *)BoxCollider.Create(geometry).GetUnsafePtr();

            var boxAabb     = rigidbodyBox.CalculateAabb();
            var boxCollider = (BoxCollider *)BoxCollider.Create(geometry).GetUnsafePtr();

            Assert.IsTrue(boxAabb.Equals(boxCollider->CalculateAabb()));
        }