Bullet physics character

Started by
13 comments, last by tmason 9 years, 10 months ago

I tried a lot searching on google about bullet physics character tutorial but I found nothing. So, I'm posting here. I want my character using bullet physics. I mean it should be able to walk left, right, forward and backward. I also want it to move in the direction where camera is looking. E.g Camera is looking back but pressing 'W' would take him in his back because camera is looking back. I don't want this. I want to walk forward in the direction of camera and i also want the Character to do collision detection with the objects in the world. How is this achieved using bullet physics? So far I found m_RigidBody->SetLinearVelocity(x, y, z); but it does not take camera's direction into consideration. m_RigidBody->ApplyCentralForce also doesn't work well for me. Also the Character's movement is unrealistic using SetLinearVelocity. What should I do? do you have have tutorial on setting up character in bullet?

Advertisement

Take camera forward direction vector and setLinearVelocity with it.

Using a rigid body as a character controller is fraught with issues. You should take a look at btKinematicCharacterController. Not sure what state it is in these days, had a few issues last time I looked.

Using a rigid body as a character controller is fraught with issues. You should take a look at btKinematicCharacterController. Not sure what state it is in these days, had a few issues last time I looked.

It's undocumented, and quite messy. And considering Bullet itself is poorly documented you won't find explanations for most of the things you won't know in it.
I personally implemented my own character controller for that reason. It takes some work but probably less than "reverse engineer" btKinematicCharacterController, and you'll understand everything in it.

I made controller based on btKinematicCharacterController and another based on rigid body for testing puposes

Both need work. Much more on btKinematicController I think.Its ghost object so you must calculate collisions yourself.

At the end I went rigid body way.

Clip:

From what I understand ghost objects are for detecting collision between specific objects, so it's suitable for pickups for example.

I made controller based on btKinematicCharacterController and another based on rigid body for testing puposes

Both need work. Much more on btKinematicController I think.Its ghost object so you must calculate collisions yourself.

At the end I went rigid body way.

Clip:

Looks good. Did you try to implement sloping floors though? That was the thing I could never get right with a Bullet rigid body. Messing about with friction and trying to stop it sliding down the slopes drove me to distraction.

From what I understand ghost objects are for detecting collision between specific objects, so it's suitable for pickups for example.

In this context, ghost object is just a Bullet shape that is created without being part of the simulation, for the purposes of querying collisions with the environment. The btKinematicCharacterController uses a ghost shape to check for collisions in the requested target position and correct the position.

I agree it is a mess and not usable last time I looked. But having just spent a long time implementing my own character controller I'd point out this is absolutely non-trivial and very hard to get something as stable as, say, Havok's.

I made controller based on btKinematicCharacterController and another based on rigid body for testing puposes

Both need work. Much more on btKinematicController I think.Its ghost object so you must calculate collisions yourself.

At the end I went rigid body way.

Clip:

Looks good. Did you try to implement sloping floors though? That was the thing I could never get right with a Bullet rigid body. Messing about with friction and trying to stop it sliding down the slopes drove me to distraction.

Yes. On slopes larger than about 45 degrees I get very slow sliding down.I will have to look into it.


Yes. On slopes larger than about 45 degrees I get very slow sliding down.I will have to look into it.

Best of luck. I found this unsolvable. Its a shame as on flat surfaces, you can get away with using a rigid body as a character controller fairly well, but the slope sliding is a deal breaker for me.

This topic is closed to new replies.

Advertisement