Panda Bullet

Nevermind, i thought the a,d keys were fo steering.

As for the jigglebones, wouldn’t this work? panda3d.org/manual/index.php … to_a_Joint

I’m not sure if it’s a good idea to attach the NodePath which contains the RigidBodyNode to the joint’s NodePath, or in other words move a Bullet node by code.

EDIT: BTW, manual mentions debugNode.setVerbose(), but the function is missing in the buildbot versions.

Yes, this is how to expose a joint. I would try to expose the joint directly to the (kinematic) rigid body node:

actorNP = Actor(...)
bodyNode= BulletRigidBodyNode(...)
bodyNP = render.attachNewNode(bodyNode)
actorNP.exposeJoint(bodyNP, 'modelRoot', 'Head')

I’m not sure how you would determine the position of the tip. Bones don’t have actual angle and lenght.

I don’t understand. What do you need these values for?
Can’t you use the NodePath positions and orientation to compute these values?

Bones are transform matrices. When you expose it, you get a Nodepath with a valid position, but orientation is not the same as the bone’s which was constructed by the 3d modeler, because the angle of the transform matrix is not the same as the angle of the bone, by my tests it can be off by 90 or 180 degrees in some angle. So if you want to create a jigglebone from a bone, I don’t see how you can get the “tip” of the bone to use for the second rigid body, because there is no “tip” information.

i.imgur.com/Lqko9.jpg

What are the red arrows on your image? Visualisations of the x-axis vectors for each exposed NodePath? Please make a new version of your image, where you also show the y-axis and z-axis vectors.

Is there any special cleanup procedure for bulletworlds other than world.removeX, world.clearDebugNode?

Do we have to manually call removeShapes to deconstruct a compound BulletRigidBodyNode shape before it gets garbage collected?

@enn0x, nope it was just a red arrow parented to an exposed joint. But if you want to see the typical red,green, blue arrows, here it is: i.imgur.com/kyZmN.jpg

No. Objects are hold in a container which is a private member of their “owner”, for example rigid bodies or constraints are owned hold by the world, or shapes are hold by a rigid body. “remove_xyz” removes the object from the owner’s collection, and thus allows destruction of the objects (if the last reference of the object is released).

It is enough to remove a rigid body node, and then all shapes hold by this node get released too. At least in theory, but there still can be bugs. So if you find any strange behaviour or memory consumption please report it (sample + description). I will try to find out why some objects get not released.

Looks good to me. To absolute positions seem to be ok. The absolute orientations are of no importance to the animation system - just the changes in orientation with time (frame by frame) matter. I still can see a pattern in the orientation.

The orientations of the joints are defined by the modeller+exporter. Different modellers+exporters will probably create different results with regard to orientation. If you want to take influence on the orientations this is where you have to look.

Anyway, you didn’t answer my question why you need the orientations. Did you consider to add new bones to your model within the modeller? For example a “weapon” bone being a child of the “left hand” bone, or a “hat” bone being a child of the “head” bone. No vertices have to be rigged to these bones. They are just for control of, well, hat or weapon.

Then you have the “head” NodePath which defines the position of the first rigid body, and the “hat” NodePath which defines the (initial) position of the jiggly hat. And if you still need to you can compute the vector from “head” to “hat”.

Well that is what I’m trying to say. It is of importance to us if we want to create a jiggle bone. If a jiggle bone consists of “base” and “tip” rigid bodies, how are we supposed to find out where to position the “tip” rigid body, if we don’t even have an actual "real " angle (not to mention a tip position)? If we had an actual angle , all we would need would be to guess the “lenght” from the base to tip, but we don’t even have enough data to do that.

PS. Hat is part of the animated mesh, rigged with all weight as “1”.

I can only repeat what I already have suggested: To define a “tip” position go to your modeller and add an additional bone, then expose it and get it’s position. If you already use the name “hat” for a bone then name it “jigglehat” or whatever you like.

You will have to change this. The hat has to be removed from the animated mesh and has to become a separate model. This separate model has to be reparented to the “tip” rigid body in order to have it move with the tip rigid body.

Yes, I heard that suggestion. You said

Which seemed like you wanted an explanation.

I dont think thats a good idea, jigglebones are also used for bones which have weights. From hair and clothes to bellies and breasts. Either way increasing the geom count is a bad idea.

As to ‘how’, im not sure, thats why I ask. Maybe only the rotations of the bones are copied from the jigglebones.

Hi Enn0x,

I could be really really super duper silly,
I think this is a typo (it was meant to be Margin instead of Marging?):
panda3d.org/reference/devel/ … xShape.php

the two methods getHalfExtentsWithMarging and getHalfExtentsWithoutMarging… or otherwise what is Marging? (if it’s correct)

Also I found that changing BitMasks on two bodies during runtime, has no effect, unless you remove and add back the bodies to the world, is this correct as well?

I just thought I would ask in-case they’re small things you might have overlooked, they’re both non-critical and have no impact other than being a tad bit confusing.

Hope this helps,
~powerpup118

I thin I have been too hasty here. It could work without separating the models, if you e. g. EXPOSE the “head” joint as kinematic body and CONTROL the “hat” joint as a dynamic body. You will have to be careful with your vertex weights. Don’t forget to post a sample once you are done.

You are right, a typo on my side. I will fix it until next weekend. Thanks for pointing this out.

Hmm, I didn’t test this case, but I thought I should work, since I directly access the masks within the filter callback (and not resot to values stored by myself). I will investigate.

The problem is that upon adding a collision object to a world Bullet performs a first collision test. And this collision test may create a persistent manifold point if the newly added object overlaps (bounding boxes!) with some other object. This persistent manifold point doesn’t get destroyed just because the PandaNode’s collision mask changed. So even if the matching of the masks returns false there is still one manifol point.

It should be somehow possible to remove this manifold point from the world’s overlapping pair cache, but this means that I have to navigate to the world (in order to access collision dispatcher and broadphase interface). Unfortunately this is not possible without increasing the memory footprint.

I will keep this point in mind, but for now I think that removing and adding the body from/to the world AFTER changing the collision mask is the best solution.

Hi,

I’m new to panda and I scout possibilities of bullet. Here’s thing what I try to achieve:

  • have instance of BulletCharacterControllerNode (call it ‘player’)
  • have instance BulletRigidBodyNode (call it ‘box’)
  • ‘player’ perform jump, collides with ‘box’ which is placed above and is knocked back

Now I want to eliminate that knockback. The only thing I’m able to do is to get instance of BulletContact via BulletWorld.contactTestPair(player, box). But I don’t know what can I do with it. Can someone give me some hint? Thanks.

Okay, that’s totally alright with me then, my next question would be what is the easiest way to remove/add a body returned by BulletWorld.contactTest(…)?

Problem I ran into was that BulletWorld.contactTest(…) returns ‘const’ bodies? and so when trying to remove the body, I get the following error:

TypeError: BulletWorld.remove_rigid_body() argument 1 may not be const

Or how else can I remove/add the body? I found a small workaround, by searching the scene graph for a node with a name of the body’s name (bodyNode.getName()) however this only works if each bodyNode has a unique name, any other way to work around this?

That’s actually originally why I wanted to ask about changing objects masks

Thank you,
~powerpup118

Hello, and welcome.
I’m afraid there is very little you can do. The Panda3D Bullet module just exposes the “original” Bullet character controller - it does not implement it’s own character controller. And the original character controller which comes with Bullet is quite incomplete. In particular the interaction between the character and other collision objects is not implemented. The lack of this feature is what you experience. The physics engine detects an overlap of two objects and just pushes them away from each other, without regard of mass or other physical properties. We do mention this lack of features in the Panda3D manual already: http://www.panda3d.org/manual/index.php/Bullet_Character_Controller

What we would need to do is to write our own, better character controller. This is quite a lot of work, and so far I don’t feel able to approach this task. A second aproach would be to find some reference implementation of a better character controller (based on Bullet) within some other open source engine, and adapt it to our Bullet wrappers.

Right now you hit a limitation of the Panda3D Bullet module. Sorry. Any ideas are welcome.