public override IntPtr CreateCollider(bool applyOffset)
        {
            Matrix4x4 offsetMatrix = Matrix4x4.identity;
            IntPtr    collider     = NewtonAPI.NewtonCreateSphere(NewtonWorld.Instance.pWorld, Radius, 0, ref offsetMatrix);

            NewtonAPI.NewtonCollisionSetScale(collider, Scale.x, Scale.y, Scale.z);
            return(collider);
        }
Example #2
0
        public override IntPtr CreateCollider(bool applyOffset)
        {
            Matrix4x4  offsetMatrix = Matrix4x4.identity;
            Quaternion rotation     = Quaternion.Euler(0.0f, 0.0f, 90.0f);

            offsetMatrix.SetTRS(Vector3.zero, rotation, Vector3.one);

            IntPtr collider = NewtonAPI.NewtonCreateCapsule(NewtonWorld.Instance.pWorld, Radius0, Radius1, Height, 0, ref offsetMatrix);

            NewtonAPI.NewtonCollisionSetScale(collider, Scale.x, Scale.y, Scale.z);
            return(collider);
        }
        public override IntPtr CreateCollider(bool applyOffset)
        {
            Matrix4x4 offsetMatrix = Matrix4x4.identity;

            if (applyOffset)
            {
                offsetMatrix.SetTRS(transform.localPosition, transform.localRotation, Vector3.one);
            }

            IntPtr collider = NewtonAPI.NewtonCreateBox(NewtonWorld.Instance.pWorld, Size.x, Size.y, Size.z, 0, ref offsetMatrix);

            NewtonAPI.NewtonCollisionSetScale(collider, Scale.x, Scale.y, Scale.z);

            return(collider);
        }
        public override IntPtr CreateCollider(bool applyOffset)
        {
            if (mesh == null)
            {
                return(IntPtr.Zero);
            }

            Matrix4x4 offsetMatrix = Matrix4x4.identity;

            if (applyOffset)
            {
                offsetMatrix.SetTRS(transform.localPosition, transform.localRotation, Vector3.one);
            }

            Vector3[] vertices = mesh.vertices;

            IntPtr collider = NewtonAPI.NewtonCreateConvexHull(NewtonWorld.Instance.pWorld, vertices.Length, vertices, 12, tolerance, 0, ref offsetMatrix);

            NewtonAPI.NewtonCollisionSetScale(collider, Scale.x, Scale.y, Scale.z);

            return(collider);
        }