Understanding how Bullet works with characters models?

I went through the panda3D manual about Bullet, but I am still a bit confused about how to go about creating a kinematic objects for character models.

I know for simple objects like a box I can create a BulletBoxShape, add mass to it, append it to the world and such. But a character can’t be encased by just a plain collision box?

For example, I toyed with UDK for a short while and played with their physics pipeline. What you do is make cylindrical tubes that encase individual body parts such as the head, forearms, hands, legs, etc… In the end, those cylindrical tubes tell UDK how that character will interact with the world.

On the this page:
panda3d.org/manual/index.php … Controller

It describes creating a BulletCapsuleShape and then attaching that to a BulletCharacterControllerNode, which then attaches to a Bullet world. However, this doesn’t describe how to attach this to an actual character model. I think the way to do this is to create an Actor node, then just attach that to the BulletCharacterControllerNode in the scene graph. (Please correct me if I’m wrong).

The part that confuses me is this:
shape = BulletCapsuleShape(radius, height - 2*radius, ZUp)

It seems like I’ll be creating a capsule with a certain radius and height, and this will encase my character model. But wouldn’t this also capture empty space near the model? And so any space within the capsule but not visually on my model will be used in collision.

For example, let’s say we want to shoot at the character. The character is in a default T-pose, where the legs are in standing position and the arms outstretched in a T-like fashion. We want to shoot at his left hand, but the bullet falls somewhere in the space between the left hand and the left leg.

The same problem applies to when the character crouches. Does this collision capsule stay the same size when the character crouches? Because then you’ll get a ton of empty space that will be counted towards collision of other objects when that shouldn’t be the case.

Then, would this mean that a collision has happened (even though the bullet clearly missed the target) since the collision area we have defined is a capsule?

There is another sample program called bullet-samples somewhere in the forums here. In the sample called 19_BallInMaze.py, it loads a ball and somehow builds builds a bullet collision node from it?

Setup scene 2: Ball

visNP = loader.loadModel('models/ball.egg')

bodyNPs = BulletHelper.fromCollisionSolids(visNP, True)
self.ballNP = bodyNPs[0]
self.ballNP.setPos(4, -4, 1)


I can’t find much information on how fromCollisionSolids() work, and whether assigning the user variables polyset=1, descend=1 stuff from 3ds max helps with this? When should I use this method as opposed to defining my own such as BulletCapsuleShape?

I guess the end question is, what is the proper way to create kinematics for a character model which requires interaction in various body parts (as opposed to just checking to see if we bump into the character)? I know there is probably some efficiency/accuracy tradeoffs in there as well, but I don’t know what they would be…

It seems like what I’m describing is called ragdoll, and is really only used for death sequences. The capsule method is usually the way to go for determining collisions in regular gameplay.

Although I am still confused about how the capsule determines when a death has occured, and how to scale down the capsule when I play a crouch animation?

Hm, I went back to the page that described Bullet Character Controller and it looks like I overlooked this part:

“Finally we want the character to crouch or duck. To achieve this we simply change the scale of the character’s collision shape.”

So it seems like Bullet already handles this case.

What about headshots though? How tight does the collision capsule have to be to ensure that the space around the head won’t count towards a headshot, if one collision capsule is used for the entire body?

Regarding headshots: The capsule shape is a good trade-off between performance and complexity. Of course you can attach a collision shape per bone of your animated actors. This is ragdolls, like you found out already, and not supported out of the box.

But you could try the following approach: use a collision mask on your character capsule which lets bullets pass through. Reparent a ghost object with a sphere shape roughly the size of the character’s head to the root character node. Use this “head” object to detect headshots.

In order to avoid excessive scene graph / physics syncing you could parent the head object below the character root only while you are in “sniper mode” or while a bullet is fired.