Collision-Detection with Kinetic Objects

Boron
Posts: 5
Joined: Mon Jul 12, 2010 7:15 pm

Collision-Detection with Kinetic Objects

Post by Boron »

Hi,

I want to use the collision-detection of Bullet. I'm working on a scifi-rts-game and all units (spaceships) are controlled by my own little "physic-engine". For the collision-detection between spaceships and between different bullet-types (laser-shots etc.) and spaceships I want to use the Bullet-engine.

My first question: Should I use a btCollisionWorld or a btDescreteDynamicsWorld? All objects of course are kinetic-objects and their positions are controlled from "outside".

My second question: I'm afraid about the problem of missing collisions (e.g. of a laser-shot and a spaceship) when a collision-detection is only performed once per step and the shot has "passed trough" the ship (old position in front of the ship, next step the position is behind the ship). Or does Bullet uses rays between the old and the actual position (or the actual and the "future"-position) of objects to detect the collisions? Which method do I have to call? Is it "btCollisionWorld::performDiscreteCollisionDetection" or do I have to create rays for each object myself and call the method "btCollisionWorld::rayTest" to get the collisions?



TIA for your help,

Boron
LEgregius
Posts: 26
Joined: Tue Oct 14, 2008 1:34 am

Re: Collision-Detection with Kinetic Objects

Post by LEgregius »

For your latter question, to make bullets work, we essentially turned off collision detection on them, then just did a ray cast between their position the last frame and the current frame. then we would see what was hit in the middle. That was the only way to get accuracy with something moving really fast.