Magnetic field affects unwanted sprite

144 Views Asked by At

I have a Player Sprite which moves as the user drag their finger across the screen. I have implemented a power that the player sprite creates a magnetic repulsive force around it. My dilemma is that when the power is turned on the player sprite itself gets affect my it when it shouldn't be.

I have set the correct fieldBitMask and categoryBitMask on the desired sprites and the field node but still doesn't work. This is my players physicsBody configuration:

physics.affectedByGravity = false
physics.allowsRotation = false
physics.dynamic = true;
sprite.physicsBody?.fieldBitMask = 0
1

There are 1 best solutions below

5
Simone Pistecchia On BEST ANSWER

Set player node:

physics.dynamic = false