Sphere collision detection

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
eugen_

Sphere collision detection

Post by eugen_ »

Does irrlicht supports spehere to sphere collision detection?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

I dont think it have function for that but its easiest and fasthest method to do. Just compare distance between two objects against their collision sphere radiuses added together. If its smaler you got collision.
Guest

Post by Guest »

yes, that is true, but then i need to calculate the direction the ball will go, after the collision...and many other things...i was interested if the engine has something already defined for this. Thanks!
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Check this post http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1850. If you download the demo you can eject spheres with collision by pressing middle mouse button.
You need to implement Newton Physics into Irrlicht for it. Mercior wrote excellent tutorial about it http://www.mercior.com/tut-newton.shtml.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Do you mean sliding? Well that is posible to code too, but it depend on your project. You need to store old position somehowe and calculate new position dependant on that.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

I think he means the physics of two balls colliding, the direction they would go etc. Using Newton would simplify this as the calculations for objects hitting and rebounding off each other is done internally ( hense the point of a physics engine ). Irrlicht has basic features for collision but it doesn't support calculations like that.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Yes thats right, Irrlicht collision methods doesn't suport something like that. If you want to do it in Irrlicht you have to code it. I think it shouldn't be too hard to make some simple phisical model for ball hitting.
eugen_

Post by eugen_ »

thanks! the best method as far i can go is to use a real phisical engine...the thing is that i need to go further with this, the balls colliding should compress under the impact force and decompress after the impact...
Thanks again!
Post Reply