assafsahar123 Posted February 16, 2016 Share Posted February 16, 2016 hi, I need to create a sort of a 3d environment, where the player needs to shoot a ball to the goal (front view - see attached image). During the flight of the ball towards the goal, it needs to hit some targets. I need some kind of 3d collision mechanism to detect if the ball collides with the targets, or with the goal itself. I guess it can be done using mathematics calculations, but I don't know where to begin. I saw there's an isometric plugin that can place objects in a z-position. Maybe this is the right solution? Has anyone got any experience with this type of problem and can share with us? Thanks! Link to comment Share on other sites More sharing options...
Alexalten Posted February 16, 2016 Share Posted February 16, 2016 Hi, I think You could follow two different path: 1) using frame number: You can create an animation for the ball (each frame contains the image of the kicked ball (the ball became smaller)). You could say:"Hey, actually the frame is the number X, I want that the range between this frame and X+4 is right to check if the ball collide with targets or not " 2) using the sprite resize method: You could check a specific size range of the ball, and then You follow the same rule of 1) (the only difference is that You'r not using a spritesheet) I hope this can help You, Bye, Alex Link to comment Share on other sites More sharing options...
assafsahar123 Posted February 16, 2016 Author Share Posted February 16, 2016 Thanks Alex, it sounds like I should give it a try. I'll publish an update after trying that. Link to comment Share on other sites More sharing options...
assafsahar123 Posted March 16, 2016 Author Share Posted March 16, 2016 Hi, I've followed path number 2 and it seems to work, but I have another question: I'm working with the Phaser framework and its built-in "arcade" physics engine. There's a 2 ways in this engine to check collisions: 1. using the "collide" method will physically respond to the collision between the objects 2. using the "overlap" method will call a function in response to the collision I used number 2, because I want the reaction to happen just when the ball is small enough (meaning it's far enough from the player), but then I have to do something to simulate the ball's reaction to the collision, therefore I miss the opportunity to use the "physical reactions" of the physics engine's. (I hope I've managed to explain it clearly enough... if not, please let me know). From your experience, is there any easier/better way to do that in Phaser? Link to comment Share on other sites More sharing options...
Recommended Posts