Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

SpriteKit Collisions

nick5454nick5454 USUniversity ✭✭✭

I have 2 SKSpiteNodes and Im trying to set the bit mask properly to Keep a sprite from colliding. I'e.., allow sprite(player) to move through sprite(enemy)

public enum Sprites : uint { Player = 1, Enemy = 2, Ground = 4 }

`Player.PhysicsBody = new SKPhysicsBody();
Player.CategoryBitMask = (uint)Sprites.Player;
Player.Dynamic = true;
Player.CollisionBitMask = ~(uint)Enemy

Enemy.PhysicsBody = new SKPhysicsBody()
Enemy.CategoryBitMask = (uint)Sprites.Enemy;
Enemy.Dyamic = true;
Enemy.CollisionBitMask = ~(uint)Sprites.Player;`

But my Player won't go through the enemy. I need it dynamic because it is a player and can be blocked by the ground. Anyone know why this setup isn't working?


Sign In or Register to comment.