How the heck do you you make two objects collide in Bullet? This is pretty straight forward in both ODE and in Panda’s built in physics handler but after 3 days of reading I still can’t pull it off in Bullet.
Here’s a simple example. I’ve opened the bullet sample file “17_Character.py” and (after removing the setmass line which now throws an error) I replaced the following:
According to the documentation and every forum post I’ve read, this should replace the generic plane with the Abstract room model from the normal mapping demo and allow Ralph to stand on the floor. Instead he plummets straight through. Why isn’t his capsule being caught by my triangle mesh?
UPDATE: Looks like I’m close. For some reason Bullet only adds collision geometry to the pyramid in the middle of the floor but not to the floor itself or the walls and pillar.
Do you guys look at what you copy & past from forum or manuals? Come on, it’s not that hard.
geomnodes = model.findAllMatches('**/+GeomNode')
gn = geomnodes.getPath(0).node()
geom = gn.getGeom(0)
So you have a model loaded from some file.
Now you search for ALL GeomNode below the model’s root node. The search result is a list of nodes. More precisely a NodePathCollection.
In the next line you pick the first - and only the first! - node from this list. All other GeomNodes get ignored.
And from this first GeomNode you pick only the first Geom.
Are you really wondering why you do not see the rest (üpillars etc.) ?
Do yourself a favour and use model.ls() after loading your model. And read the output on the console, in case this is not obvious. You will see that each of the GeomNodes below the model’s root hat a transform relative to the model’s root. You have to get this transform and provide it to Bullet when adding shapes.
It has not been the first time that I explained this.
Now look at the following snippert (which is part of the current bullet-samples.zip).
model = loader.loadModel('models/box.egg')
for gnp in model.findAllMatches('**/+GeomNode'):
gnode = gnp.node()
ts = gnp.getTransform(np)
geom = gnode.getGeom(0) # <-- still only first geom
mesh = BulletTriangleMesh()
mesh.addGeom(geom, True, ts) # <-- apply ts either here...
shape = BulletTriangleMeshShape(mesh, dynamic=False)
np.node().addShape(shape, ts) # <-- ...OR here
Ennox, thanks, but if you’ll notice I’ve already marked this as solved. After 6 years of panda and 3 years on the forum you’d think I’d know better but I suppose I’m just a perennial skiddie. Wish I was a CMU alumni so I knew how to code.
“Someone” has gotten bullet 2.81 (mostly) working with Panda 1.9x in a manner that doesn’t require a lot of superfluous loc or familiarity with deprecated methodologies. For those in the know check his SO prof for the dl or you can hit him up on the sporks irc. So far it’s only been tested on Nadia (lm14) so you have the usual caveats if you’re on windows.
Sorry, didn’t see. i thought you are close, but not yet there (your last UPDATE to the original post).
I am interested in this code too. Doesn’t make sense to maintain lots of superfluous lines of code with deprecated methodologies if there is a shiny compact solution on its way. I think we should consider exchanging the current Panda3D code with this new one.
On a complete side note, Ennox, have you ever been to a pornographic website? If so then you’ve probably seen the advertisements for adult 3d games and media in the margins. You might wonder, how do those people have enough money to advertise on so many sites, some of which are on the Alexa top 50? That can’t possibly be cheap, can it? You might also be curious as to what the most common game engines are behind these products. Even with a modest amount of capital it must be hard to get a license for most proprietary stuff given the nature of it’s use. Probably just be easier to get something open source and pay folks to fix project specific problems as they arise. You can literally rent Chinese programmers by the room full for less than 200 usd per day.
I would consider letting you see my complete build but only if I could be assured that you would not disclose any information regarding the contents to any party nor attempt to distribute it in part or in whole. You may only verify that it has bullet 2.81 implemented in a way that is superior to the vanilla build.
And you would also have to ask in a manner that isn’t dripping with sarcasm and incredulity.
Sarcasm has not been intended, seriously. I’m not a native speaker, so please bear with me.
If there are better approaches to integrate Bullet with Panda3D (and there are!) then I am more than willing to use these designes for a rewrite, or have someone else (you?) replace the whole module. Panda3D really could use more active developers.
Of course this means that this code gets part of the open source Panda3D trunk. If you have comercial interests in your code and don’t want the code (or part of it) to become open source then this is fine too. Nobody is forced to help improve Panda3D.
On a sidenote: the current Panda3D trunk builds fine with Bullet 2.81 too. Actually I have no 2.80 libs on my machine any longer, and use 2.81 exclusively. But I don’t want to spend much more effort on the 2.x versions of Bullet, now that 3.0 is very close. My current effort goes into replacing the PhysX 2.8 integration with PhysX 3.3, using a completely different integration patter than for the Bullet code. Bullet 3.0 should be ready when I am done with PhysX 3.3, and I can use the gained experience in writing a better (?) Bullet 3.0 module. That is only if there is nobody else who want to do it.