How to use the planck-js.DistanceJoint function in planck-js

To help you get started, we’ve selected a few planck-js examples, based on popular ways it is used in public projects.

github grtlr / bubble-treemaps / src / implementation / algorithm / layoutplanck.js View on Github external
layerClusterBodies.forEach(function(layerClusterBody) {
        let distanceJoint = planck.DistanceJoint( {
                frequencyHz : 0.9, // TODO: Try to avoid overlapping in large datasets!
                dampingRatio : 0.001 // TODO: ''
            },
            attractorBody,
            attractorBody.getPosition(),
            layerClusterBody,
            layerClusterBody.getPosition()
        );
        distanceJoint.m_length = 0; // Set the length to zero as it's calculated as the distance between the anchors. TODO: PR on planck-js repo to fix bug.

        world.createJoint(distanceJoint);
    });

planck-js

2D JavaScript physics engine for cross-platform HTML5 game development

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis