jtmwanakhu
jtmwanakhu

Reputation: 633

Magnetic field affects unwanted sprite

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

Upvotes: 0

Views: 145

Answers (1)

Simone Pistecchia
Simone Pistecchia

Reputation: 2840

Set player node:

physics.dynamic = false

Upvotes: 0

Related Questions