Jump to content

OnDragUpdate drag other sprite together


Recommended Posts

I have some joints and some connected joints to those joints. What i want to achieve is, move the connected joints whenever a father is moved, but it seems the child joint is moving more then the father joint.


This is my drag update function:


    onDragUpdate(e) {
        if(this.connectedJoints.length > 0) {
            const differenceX = e.position.x - e.previousPosition.x;
            const differenceY = e.position.y - e.previousPosition.y;
            this.connectedJoints.forEach(joint => {
                joint.sprite.x += differenceX;
                joint.sprite.y += differenceY;

It appears the connected joint moves more then the original joint.

Any ideas why is this wrong ??


Best regards

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...