KevinnFtw 3 Report post 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 Quote Share this post Link to post Share on other sites
Heppell08 78 Report post Posted May 26, 2014 Don't give the invisible stuff a physics body...Or set the physics body to null. Quote Share this post Link to post Share on other sites
KevinnFtw 3 Report post Posted May 26, 2014 Will try that, thanks Quote Share this post Link to post Share on other sites
KevinnFtw 3 Report post 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? Quote Share this post Link to post Share on other sites
rich 2610 Report post Posted May 27, 2014 Which physics system are the sprites using? (arcade, p2?) Quote Share this post Link to post Share on other sites
KevinnFtw 3 Report post Posted May 27, 2014 They are using ARCADE. Quote Share this post Link to post Share on other sites
rich 2610 Report post 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. 1 KevinnFtw reacted to this Quote Share this post Link to post Share on other sites
KevinnFtw 3 Report post Posted May 27, 2014 That is amazing, thanks alot Rich! Quote Share this post Link to post Share on other sites