kinematic aeroplane?

kneeride
Posts: 3
Joined: Tue Aug 24, 2010 2:18 am

kinematic aeroplane?

Post by kneeride »

Hi guys, my first post here :-)

I’m wanting to integrate Bullet into my game which does not use a physics library. I’m however a bit unsure how to handle my aeroplane object.

I want the aeroplane to stay on the same height plane (eg Y = 100) and to roll when it turns.

I’m thinking of using a kinematic rigid body because I have already written the controller logic. Is this a good idea?

How is collision detection handled with kinematic objects to avoid two kinematic objects from going through each other. I also want the aeroplane to handle bumps from other objects where 2 planes nudge each other. Is this possible with kinematic objects?

Any tips would be appreciated. Thanks.
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: kinematic aeroplane?

Post by ola »

Hi,

if you use the kinematic objects, it's still possible to write code to handle all kinds of collisions and how to handle them. But you will soon see that it can be complicated to handle all the various cases that will come up. The kinematic character controller is an example of this, so you should take a look into that. In general, if you use kinematic objects, you must write all the code yourself on how they should move and react to collisions. All Bullet can give you in this case is collision data (who collided and where, etc.).

I would rather let Bullet do the rigid body simulation. You can still easily limit your aircraft rigid body to stay in a 2D plane, by using the btRigidBody::setLinearFactor and the btRigidBody::setAngularFactor functions. You can take a look at one of the demos (I think the Box2DDemo) to see how these are used. You can use a constraint to set the rotation you are after, and apply forces or impulses to move it around. By using the damping factors you can limit the top speed. Also you can simplify things -- maybe only your graphics model of your aircraft needs to roll, while the rigid body doesn't.

You might have to rewrite some things to get this working since you already have your control logic, but I think trying to handle collisions between kinematic bodies often gets a bit messy, especially if you have several of them colliding with each other.

I guess it also depends on how your game is supposed to behave, if it should feel like a "physics based game" or not.

Cheers,
Ola
kneeride
Posts: 3
Joined: Tue Aug 24, 2010 2:18 am

Re: kinematic aeroplane?

Post by kneeride »

great tips, thanks!