Continuous Collision Detection with Havok

Are you saying it works at normal speeds, but not when you are swinging very fast?

I’m a noob, but for me your code seems correct. Having said that, I found this on the forums:

There is a limit on velocity on physics objects in Havok, which is meant to be pretty fast, but maybe not fast enough for your use-case. There is a way to override this though however:

function setMaxLinVel(havokPlugin, maxLinVel, maxAngVel) {
        const heap = havokPlugin._hknp.HEAP8.buffer;
        const world1 = new Int32Array(heap, Number(havokPlugin.world), 100);
        const world2 = new Int32Array(heap, world1[9], 500);
        const mplib = new Int32Array(heap, world2[428], 100);
        const tsbuf = new Float32Array(heap, mplib[8], 300);

        tsbuf[32] = maxLinVel;
        tsbuf[33] = maxAngVel;
        tsbuf[60] = maxLinVel;
        tsbuf[61] = maxAngVel;
        tsbuf[88] = maxLinVel;
        tsbuf[89] = maxAngVel;
        tsbuf[144] = maxLinVel;
        tsbuf[145] = maxAngVel;
        tsbuf[172] = maxLinVel;
        tsbuf[173] = maxAngVel;
        tsbuf[200] = maxLinVel;
        tsbuf[201] = maxAngVel;
        tsbuf[228] = maxLinVel;
        tsbuf[229] = maxAngVel;
    }

I recommend looking through the post, and maybe someone else can jump in from the community to help out if this doesn’t work.

Best of luck, let me know how it goes and hopefully see your project in action soon :slight_smile: