Gamerazor Posted April 11, 2015 Share Posted April 11, 2015 Hello. I have seen in other post that oimjs doesn't detect collisions and this is a big problem for tha game that I'm doing that is similar to Arkanoid but in 3D. I need impulse the ball when collide with the bar and need detect when the ball collide with some box for it disappears. How can I resove this problem? Is there any alternative with oimjs to detect collisions? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 11, 2015 Share Posted April 11, 2015 Hello! This is not true: OIMO.js is perfectly suited to detect collisions between spheres and boxes: You can have a look at this post for more info:http://www.sitepoint.com/understanding-collisions-physics-babylon-js-oimo-js/?utm_content=buffer62396&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer Quote Link to comment Share on other sites More sharing options...
Gamerazor Posted April 11, 2015 Author Share Posted April 11, 2015 ok, but how can get when the bar collide with the ball? That tutorial only explains to get the mesh when pick in it.can you tell me any example with my case, please? thanks Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 12, 2015 Share Posted April 12, 2015 Hi GR Maybe take a look at this... http://playground.babylonjs.com/#1VNAYW#1 In this demo, the target has been setPhysicsState... meaning the ball bounces off of it. BUT... if you had many targets stacked atop each other (like Arkanoid), and ALL their physics were set... then they might rub together and cause over-colliding. You may want to keep a small space between all targets. The demo below uses no physics state for target. Its easier to place many targets stacked atop each other..... without massive target colliding... but there is nothing to push the ball back towards the paddle when a target collide-and-dispose-it happens. In other words, if the ball power is rather high, then the ball can travel upward past the target. http://playground.babylonjs.com/#1VNAYW Maybe... if intersect... 1. Dispose of the intersected target 2. Apply impulse on the ball - downward toward paddle. Ideally, the force is the perfect inverse direction and velocity (a proper rebound). You might find that putting a smaller box or plane INSIDE-OF each target box... and setPhysicsState on the hidden inside object, but NOT on the target box itself... might be useful. The ball will sink into the target a certain amount... before the intersect triggers. (Might look cooler and prevent unwanted target-to-target collisions.) I assume you know that this game could be built WITHOUT using a physics engine, yes? A bit of math from the early pong games, mixed with a bit of homemade rubber for velocities (more math), and you could do the paddle->ball reactions yourself. And, the game would be MUCH faster, I aimlessly predict. I hope some of this stuff helps. Be well. Gamerazor 1 Quote Link to comment Share on other sites More sharing options...
Gamerazor Posted April 12, 2015 Author Share Posted April 12, 2015 Thank you Wingnut the first example is useful. It resolve my problem. Thank you. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
fenomas Posted April 12, 2015 Share Posted April 12, 2015 Just out of curiosity, so there's really no way to get collision events from oimo? It seems a waste to have to check the ball against all the game blocks even though oimo has just done the same thing.. Quote Link to comment Share on other sites More sharing options...
RaananW Posted April 12, 2015 Share Posted April 12, 2015 @fenomas - this was discussed already here - http://www.html5gamedevs.com/topic/10353-collision-check-with-oimo/ . Oimo doesn't suppor the event, but i believe it shouldn't be too hard adding the feature. This will require changing oimoJS thou. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.