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')
visNP.clearModelNodes()
bodyNPs = BulletHelper.fromCollisionSolids(visNP, True)
self.ballNP = bodyNPs[0]
self.ballNP.reparentTo(render)
self.ballNP.node().setMass(1.0)
self.ballNP.setPos(4, -4, 1)
self.ballNP.node().setDeactivationEnabled(False)
visNP.reparentTo(self.ballNP)
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…