-
Notifications
You must be signed in to change notification settings - Fork 7.1k
matterjs attractor plugin not working with image #5160
Copy link
Copy link
Closed
Description
Version
- Phaser Version: 3.22
- Operating system: Linux
- Browser: Firefox
Description
I cannot make matterjs attractor plugin work with a simple image or sprite. I can see that the example works with imageStack, but not with an image or a sprite. Tried looking at the code, but cannot see what makes imageStack special in this case.
Example Test Code
I modified the example just to have one image from imageStack and one normal image:
function create ()
{
this.matter.world.setBounds();
this.matter.add.image(0, 400, 'alien', null, {
mass: 0.5,
ignorePointer: true
});
this.matter.add.imageStack('alien', null, 0, 500, 1, 1, 0, 0, {
mass: 0.5,
ignorePointer: true
});
var sun = this.matter.add.image(400, 200, 'sun', null, {
shape: {
type: 'circle',
radius: 64
},
plugin: {
attractors: [
function (bodyA, bodyB) {
return {
x: (bodyA.position.x - bodyB.position.x) * 0.000001,
y: (bodyA.position.y - bodyB.position.y) * 0.000001
};
}
]
}
});
this.matter.add.mouseSpring();
}
This makes only the alien from imageStack get attracted to the sun.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels