I have a bit special case: a sprite is moved by a matter mouseSpring. Works fine.
I have to simulate magnetic attraction while holding/moving the sprite. Means the sprite moves a bit in the direction of another object (magnet)
This is done in scene.update() by manipulation sprite x/y towards the magnet. Just a bit. The effect works as expected.
The problems begins when you release the mouse button (drag-end). Then the mouse spring force is applied by matter. The sprite is pulled back in direction to the mouse position (like a spring would do). This is kind of the expected behaviour, but I would like to stay the sprite on it’s position (which is a bit away from the mouse pointer).
I tried many events from phaser and matter (dragend, beforeupdate, step, beforestep) to stop that, but I can’t force matter to let that sprite stay where it is.
I also call this.matter.step() instead of autoUpdate to get some control.
sprite.setVelocity(0,0) in some of the event hooks helped a bit, but still there’s a bit movement.
Is there a event/hook I should use, or how can I force matter to stop the connection between the mouse spring and the sprite?