Page 1 of 1

Collisions

Posted: Wed Jun 04, 2008 11:06 am
by Jesseyay
Hello.

Does anybody know how to test if two Entities have collided?
I've found the Toolbox.areObjectsColliding method but it slows down too much when called more than 100 times per frame.

I want something usable so that I can detect collisions between players and bullets and subtract health etc.

Thanks.

Re: Collisions

Posted: Wed Jun 04, 2008 5:36 pm
by Zukarakox
I made a method that does it until Norbo makes his own and puts it into the physics engine.

http://www.bepu-games.com/forums/viewto ... ?f=9&t=309

tell me if you have any problems, I made that for v0.4.0 so it might need a bit of updating.

Bullets move too fast to see really, so you might just want to do a ray vs world test to see what they hit, and if it hits a player, subtract health.

Re: Collisions

Posted: Wed Jun 04, 2008 8:11 pm
by Norbo
The idea behind identifying colliding objects is determining which object pairs (controllers) have contacts in them. Collision pairs are automatically sorted out inside the engine, and the associated space keeps a listing of them around. Checking through each one and identifying the ones with contacts will find all colliding pairs.

A more direct method is planned in v0.6.0.