Miroku_87 Posted August 6, 2014 Share Posted August 6, 2014 Hey everybody,I'm looking for a way to check if a sprites encounters another sprite on a given trajectory BEFORE it evens starts moving.That's because if the sprite will collide with an another one while moving in that direction I don't even want it to go. Can somebody please explain to me how can I accomplish that? Thank you in advance! Link to comment Share on other sites More sharing options...
valueerror Posted August 7, 2014 Share Posted August 7, 2014 http://gamemechanicexplorer.com/#bullets-5 maybe this helps? Link to comment Share on other sites More sharing options...
Miroku_87 Posted August 7, 2014 Author Share Posted August 7, 2014 Thank you valueerror I will take a look at it! Link to comment Share on other sites More sharing options...
MichaelD Posted August 7, 2014 Share Posted August 7, 2014 You can also check one of my blog posts here: http://nightlycoding.com/index.php/2014/01/remote-collision-detection-for-games/ Here I find the angle where the two objects meet and I stop the rotation of the canon when the right angle is reached, without them colliding or even be close. Link to comment Share on other sites More sharing options...
Miroku_87 Posted August 7, 2014 Author Share Posted August 7, 2014 Thank you MichaelD but maybe it wasn't clear that my question wasn't about how to do it regularly.I know methods myself, but I was wondering if Phaser came in help to developers with a quicker way. Thank you the same Link to comment Share on other sites More sharing options...
valueerror Posted August 8, 2014 Share Posted August 8, 2014 a willithitsprite() function that returns the sprite? uhh.. i could use something like that.. Link to comment Share on other sites More sharing options...
Miroku_87 Posted August 8, 2014 Author Share Posted August 8, 2014 Yes exactly!But well, if it doesn't already exists I will do it myself =) Link to comment Share on other sites More sharing options...
lewster32 Posted August 8, 2014 Share Posted August 8, 2014 I imagine something like that in the physics engine should be fairly easy to add? If you know the velocity and size of both objects, you can make an accurate prediction for whether they'll intersect at some point in the future. I guess it'd have to be a simplistic prediction though, as gravity, drag, collisions and so on will all muddy the waters. Maybe gravity and drag can be added to the equation but collisions will make it much more difficult. Link to comment Share on other sites More sharing options...
Recommended Posts