How to disable mouseSpring for some objects?

Hi friends

by using “this.matter.add.mouseSpring()” in matter physics I can move all game objects using mouse pointer, what if i need it just for some objects not for all of them?

How can i enable or disable it for some objects?

You can use the ignorePointer property in the body configuration object:

 this.matter.add.sprite('nonInteractiveGO', xPos, yPos, 'atlasId', 'frameId', {
        mass: 0.5,
        ignorePointer: true
    });

Don’t know if there is another way, but this should work

2 Likes

Thanks glantucan, using “object.body.ignorePointer = true” it works now :+1: :pray:

1 Like

hi,
And how do you restrict the pointer to a specific zone to avoid that the body go out of the world?