This project has moved and is read-only. For the latest updates, please go here.

Collisions Help

Feb 5, 2009 at 12:32 AM
Edited Feb 5, 2009 at 12:33 AM
Hi all,

I am trying to make a NPC(non playing character) object that collides with all world objects (like floors and walls), but does not collide with the player geom in a 2D sidescroller setting. I've tried setting the collision groups of both the NPC and player to the same value, and this works in preventing them to collide.

However, when I do this the OnCollision event no longer seems to fire, even though I want it to. What i'm trying to do is allow the player to speak to the NPC when touching it, and also allow the NPC to move around (so the NPC cannot be static like a sensor is). Other things i've tried are setting CollisionResponseEnabled to false, but then the NPC falls through the floors and walls.

Thanks for any help!
Feb 5, 2009 at 12:55 AM
Could you get the position of the NPC every loop, and then get the players position. Now lets assume that the NPC is currently at 30, 0 and the player is at 0, 0. The npc is 5 wide and 10 high and the player is the same, when the player moves forward by 25 the edge of the player hits the edge of the NPC and it will execute your speech code.