KevinnFtw Posted May 26, 2014 Share Posted May 26, 2014 Hey guys, In my game I hide some sprites by setting their visible setting to false.Problem is, my collision detection still detects if these invisible sprites are getting hit. I would like to know how I can make the collision detection ignore them. Recently I've seen a option on these forums which was something like sprite.collision = false.I think it was an option to ignore the collision of a certain sprite. Too bad I can't find that post or option anymore, so that's why I'm making a new post about it. Hope anyone can help me, otherwise I'll have to write my own detection for just visible sprites but enabling some kind of option would be much easier. Thanks,Kevin Link to comment Share on other sites More sharing options...
Heppell08 Posted May 26, 2014 Share Posted May 26, 2014 Don't give the invisible stuff a physics body...Or set the physics body to null. Link to comment Share on other sites More sharing options...
KevinnFtw Posted May 26, 2014 Author Share Posted May 26, 2014 Will try that, thanks Link to comment Share on other sites More sharing options...
KevinnFtw Posted May 26, 2014 Author Share Posted May 26, 2014 So I'll just need to do sprite.body = null?If I want to re-enable the body of the sprite in a later stage where the sprite is visible again, how should I do that? Link to comment Share on other sites More sharing options...
rich Posted May 27, 2014 Share Posted May 27, 2014 Which physics system are the sprites using? (arcade, p2?) Link to comment Share on other sites More sharing options...
KevinnFtw Posted May 27, 2014 Author Share Posted May 27, 2014 They are using ARCADE. Link to comment Share on other sites More sharing options...
rich Posted May 27, 2014 Share Posted May 27, 2014 Yeah I added this into arcade last night and pushed this morning: https://github.com/photonstorm/phaser/commit/9c35dfde0c8588789dd5430238d263c64dc4dea2 Will be in 2.0.6, but is in dev branch if you want it right now. KevinnFtw 1 Link to comment Share on other sites More sharing options...
KevinnFtw Posted May 27, 2014 Author Share Posted May 27, 2014 That is amazing, thanks alot Rich! Link to comment Share on other sites More sharing options...
Recommended Posts