ZoomBox Posted April 11, 2014 Share Posted April 11, 2014 Hello !I'm wondering what would be the best way to have pickable objects (with Physics.P2) ? I mean, I wan't to be able to interact with this item by its body but without it to be blocking me. The scenario would be: I have a Player class, a Pickable class (a coin). Once the player's body touches the coin's body it fires an event (like onBeginContact) but never blocks me. It looks possible with:-Sprite.overlap (but not accurate at all)-Solid bodies and body.onBeginContact(...) then I immediatly clearShapes (but it's not clean, and the player will still be stuck 1 frame)... Thank you :-) ! Link to comment Share on other sites More sharing options...
Wavertron Posted April 11, 2014 Share Posted April 11, 2014 What if you make the coin into a P2 sensor? sprite.body.data.shapes[0].sensor = true; (Credit goes to this thread I was just reading... http://www.html5gamedevs.com/topic/5567-trigger-with-p2/) Mefteg and plicatibu 2 Link to comment Share on other sites More sharing options...
ZoomBox Posted April 11, 2014 Author Share Posted April 11, 2014 Thank you, that's exactly what I wanted :-DI'm gonna try it. It works perfectly. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts