DellaFree Posted August 1, 2015 Share Posted August 1, 2015 Hi guys ! My studying continue, but every new argument I start studying, I find a lots of things that I don't understand well Today, is the turn of the collision/intersection between meshes. So I made this PG: http://www.babylonjs-playground.com/#2AGEE5 (I found it in another topic). I would that every time some sphere collide with a box, decrements its "counter life" by 1, but I notice that it does not decrement by one every time, but sometimes 2 or 3. Maybe, I suppose, that the reason is that the sphere intersects, first, one face of the cube, and then others (based on the trajectory), so it decrements the counter life every time it collides with some face; am I right? So how can I make that every time on sphere collide with a cube, decrement its "counte life" just by one?And the other thing is that: every time I click, one sphere (bullet) is created, so I need to check if it intersect the cube, and I do that in a if-statement inside the scene.renderLoop(); but if I have a lots of cube, and click very quicly, every frame I should cycle over the box array and check for collision with the sphere, or alternatively, every click I should cycle on the box array and check for collision with the box; but I think that this reduce a lots the performance. I try to use the actions, but with no success (maybe I'm missing something). Is there a way to applay actions to my case, avoiding the continue cycling over the array of boxes?Many thanks guys. Quote Link to comment Share on other sites More sharing options...
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.