Panda Bullet

Return to Panda Features in Development

Postby powerpup118 » Sat Apr 14, 2012 3:42 pm

Using Panda Bullet, how can I set the CFM/ERP parameters of BulletConstraint()'s?

In C++ code
Code: Select all
constraint->setParam(BT_CONSTRAINT_STOP_CFM, myCFMvalue, index)
constraint->setParam(BT_CONSTRAINT_STOP_ERP, myERPvalue, index)


How would one set those parameters in Panda Bullet? I looked at BulletConstraint's API, as well as those who inherit from it (BulletHingeConstraint) and found no method to.

Thank you,
~powerpup118
User avatar
powerpup118
 
Posts: 325
Joined: Sat Apr 17, 2010 11:59 pm

Postby enn0x » Sun Apr 15, 2012 6:16 pm

These parameters are not exposed so far. I have just added them.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby powerpup118 » Sun Apr 15, 2012 10:47 pm

Thank you Enn0x, I really appreciate all of your work.

Thank you :D

~powerpup118
User avatar
powerpup118
 
Posts: 325
Joined: Sat Apr 17, 2010 11:59 pm

Bullet: problem with BulletTriangleMesh or Egg file ?

Postby benicourt81 » Fri Jun 01, 2012 3:11 am

Hello,
I've tried to use an egg file as a map for a test, and ... look at the screen shots:
Image
Image

The code i used for the map is:
Code: Select all
   # Load the environment model.
      self.map = self.loader.loadModel("models/map")
      geom = self.map.findAllMatches('**/+GeomNode').getPath(0).node().getGeom(0)
      mesh = BulletTriangleMesh()
      mesh.addGeom(geom)
      shape = BulletTriangleMeshShape(mesh, dynamic=False)
      body = BulletRigidBodyNode('map')
      bodyNP = self.worldNP.attachNewNode(body)
      bodyNP.node().addShape(shape)
      bodyNP.setCollideMask(BitMask32.allOn())
      self.world.attachRigidBody(bodyNP.node())
      self.map.reparentTo(bodyNP)


Where is the problem ? Blender 2.63 don't export (with Yabee) the blend file, but with export directx and x2egg, i can use it with panda. But is it possible that there is a problem with the geom ?

Here is the blend and egg files : http://www.benicourt.com/bullet/models.rar
Panda3D and Blender... my favourite toys !
benicourt81
 
Posts: 60
Joined: Tue Aug 03, 2010 2:44 am

Re: Bullet: problem with BulletTriangleMesh or Egg file ?

Postby enn0x » Sat Jun 02, 2012 2:10 pm

benicourt81 wrote:Where is the problem ? Blender 2.63 don't export (with Yabee) the blend file, but with export directx and x2egg, i can use it with panda. But is it possible that there is a problem with the geom ?

The problem ist that the geom you pick from the loaded model has a transform, which you not regard when creating the collision mesh:
Code: Select all
...
<Group> Root {
  <Transform> {
    <Matrix4> {
      1 0 0 0
      0 0 1 0
      0 1 0 0
      0 0 0 1
    }
  }
  <Group> Root1 {
...

Good luck that you .egg file only contains one geom, because you only regard the very first geom found inside the .egg file.

This is a more *complete* ways of creating collision meshes from models:
Code: Select all
    np = loader.loadModel('map.egg')
    mesh = BulletTriangleMesh()
    for geomNP in np.findAllMatches('**/+GeomNode'):
      geomNode = geomNP.node()
      ts = geomNP.getTransform(np)
      for geom in geomNode.getGeoms():
        mesh.addGeom(geom, ts)
    shape = BulletTriangleMeshShape(mesh, False)
    ...

Anyway, it might be very convenient to simply create collision meshes from visible models. And Bullet and PhysX can do collision detection with triangle meshes quite fast, but I still recommend using simplified meshes for collisions.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby benicourt81 » Sun Jun 03, 2012 3:37 am

@ enn0x, thank you very much, i've modified the egg file, only the transformation matrix, and it's good. In the panda manual, i've read that the model must not have a scale transformation, not a rotation... now, i know.
I've noticed also the code if there is more than one geom. Thank you again.
Panda3D and Blender... my favourite toys !
benicourt81
 
Posts: 60
Joined: Tue Aug 03, 2010 2:44 am

include files for c++ usage of Bullet/ compile PANDA Bullet

Postby zonzagolo » Sat Jun 09, 2012 11:24 am

I tried to compile a c++ panda program wishing to use bullet.

I get
Code: Select all
1>C:\Panda3D-1.8.0\include\bullet_includes.h(20): catastrophic error: cannot open source file "btBulletDynamicsCommon.h"
1>  #include "btBulletDynamicsCommon.h"

So what are the bullet include files needed for use in a c++ panda app, and where are they located. Grazie.

Another concern: I tried to compile a complete Panda3D version including the latest Bullet svn (2.8?) (from bullet svn repository).
Here is what I get.
1>c:\panda3d\panda\src\bullet\bulletWorld.h(137) : error C2259: 'BulletContactResult' : cannot instantiate abstract class
1> due to following members:
1> 'btScalar btCollisionWorld::ContactResultCallback::addSingleResult(btManifoldPoint &,const btCollisionObjectWrapper *,int,int,const btCollisionObjectWrapper *,int,int)' : is abstract
1> c:\panda3d\thirdparty\win-libs-vc9\bullet\include\BulletCollision/CollisionDispatch/btCollisionWorld.h(424) : see declaration of 'btCollisionWorld::ContactResultCallback::addSingleResult'
1>c:\users\jc\desktop\panda_build_bot\source maj\panda3d\panda\src\bullet\bulletWorld.h(138) : error C2259: 'BulletContactResult' : cannot instantiate abstract class
1> due to following members:
1> 'btScalar btCollisionWorld::ContactResultCallback::addSingleResult(btManifoldPoint &,const btCollisionObjectWrapper *,int,int,const btCollisionObjectWrapper *,int,int)' : is abstract
1> c:\panda3d\thirdparty\win-libs-vc9\bullet\include\BulletCollision/CollisionDispatch/btCollisionWorld.h(424) : see declaration of 'btCollisionWorld::ContactResultCallback::addSingleResult'
1>built/tmp/libpandabullet_igate.cxx(25664) : error C2259: 'BulletContactResult' : cannot instantiate abstract class
1> due to following members:
1> 'btScalar btCollisionWorld::ContactResultCallback::addSingleResult(btManifoldPoint &,const btCollisionObjectWrapper *,int,int,const btCollisionObjectWrapper *,int,int)' : is abstract
1> c:\panda3d\thirdparty\win-libs-vc9\bullet\include\BulletCollision/CollisionDispatch/btCollisionWorld.h(424) : see declaration of 'btCollisionWorld::ContactResultCallback::addSingleResult'
1>built/tmp/libpandabullet_igate.cxx(25665) : error C2259: 'BulletContactResult' : cannot instantiate abstract class
1> due to following members:
1> 'btScalar btCollisionWorld::ContactResultCallback::addSingleResult(btManifoldPoint &,const btCollisionObjectWrapper *,int,int,const btCollisionObjectWrapper *,int,int)' : is abstract
1> c:\panda3d\thirdparty\win-libs-vc9\bullet\include\BulletCollision/CollisionDispatch/btCollisionWorld.h(424) : see declaration of 'btCollisionWorld::ContactResultCallback::addSingleResult'
1>built/tmp/libpandabullet_igate.cxx(25755) : error C2259: 'BulletContactResult' : cannot instantiate abstract class
1> due to following members:
1> 'btScalar btCollisionWorld::ContactResultCallback::addSingleResult(btManifoldPoint &,const btCollisionObjectWrapper *,int,int,const btCollisionObjectWrapper *,int,int)' : is abstract

Zonzagolo
zonza
zonzagolo
 
Posts: 28
Joined: Tue Jan 10, 2012 3:51 pm
Location: casa mia

Postby enn0x » Sun Jun 10, 2012 7:22 am

The Panda3D Bullet module is a wrapper/integration for the C++ Bullet library. The classes provided by the Panda3D Bullet module "wrap" original Bullet classes. Therefor they need to know the original Bullet objects, and in order to compile you need the Bullet headers and libs. Ok, but I think you already know this.

1) Dependencies of Panda3D are located in a so-called "third-party" libs directory, which should be downloadable from the Panda3D download section (for Windows users). There are only a few exceptions, like the Platform SDK, DirectX or PhysX). Bullet headers and libs should be there too.

2) The latest Bullet SVN is not working - you need the right version of the Bullet headers and libs. Either from the third-party libs, or from Bullet SVN. I am using Bullet SVN r2476, and I think rdb has the same version on the Panda3D build machines.

A bit more information if you like to know: Bullet is an active project, and changes it's API frequently. Keeping up-to-date would mean (1) a lot of work for us, and (2) possible changes to the Panda3D Bullet API if the Bullet API changes. This is not what we want, because people using Panda3D should have some consistenty of the API they depend on.

Our update plan look like this:
- Update to the latest Bullet SVN for each new "feature" release of Panda3D (1.8.0, 1.8.2, 1.8.4, 1.9, ... you get the pattern - odd releases are mainly bugfix releases).
- Update to the latest Bullet SVN if there are critical bugs which require a newer Bullet version for fixing.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby zonzagolo » Sun Jun 10, 2012 7:56 am

Grazie,
I can't find svn2476 in http://code.google.com/p/bullet/downloads/list, is svn2440 ok or outdated?

No problem with the headers in the Third-party directory, my first question was: what are the headers to be included in a panda3d c++ bullet program?

It is a little bit confusing since during a full panda3d build (without installer) it appears that some directories are not copied automatically by makepanda into the build directory hierarchical structure, and some manual transfer has to be done.
With Python this is ok but It's not clear where to put the various bullet headers and files such as "btBulletDynamicsCommon.h" so that a Panda C++ program can refer to them.
zonza
zonzagolo
 
Posts: 28
Joined: Tue Jan 10, 2012 3:51 pm
Location: casa mia

Postby enn0x » Sun Jun 10, 2012 3:44 pm

zonzagolo wrote:Grazie,
I can't find svn2476 in http://code.google.com/p/bullet/downloads/list, is svn2440 ok or outdated?

If I remember right there has not been much changes betweem 2440 and 2476. You could give it a try - I can't tell for sure without trying myself.
Of you could use an SVN client to get exactly the version r2476 from the SVN server.

zonzagolo wrote:No problem with the headers in the Third-party directory, my first question was: what are the headers to be included in a panda3d c++ bullet program?

The following source file has a list of all include which are required: panda/src/bullet/bullet_includes.h
Code: Select all
#include "btBulletDynamicsCommon.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
#include "BulletCollision/CollisionDispatch/btManifoldResult.h"
#include "BulletCollision/CollisionShapes/btConvexPointCloudShape.h"
#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
#include "BulletCollision/Gimpact/btGImpactShape.h"
#include "BulletDynamics/Character/btKinematicCharacterController.h"
#include "BulletDynamics/Vehicle/btRaycastVehicle.h"
#include "BulletSoftBody/btSoftBodyHelpers.h"
#include "BulletSoftBody/btSoftBodyInternals.h"
#include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h"
#include "BulletSoftBody/btSoftRigidDynamicsWorld.h"


zonzagolo wrote:It is a little bit confusing since during a full panda3d build (without installer) it appears that some directories are not copied automatically by makepanda into the build directory hierarchical structure, and some manual transfer has to be done.
With Python this is ok but It's not clear where to put the various bullet headers and files such as "btBulletDynamicsCommon.h" so that a Panda C++ program can refer to them.

Umm... I'm a bit confused here too. There is no need to copy anything usually. Panda3D's include directory contains only the header files of the Panda3D objects. The third-party header files should be picked up by a C++ program directly from the third-party directory.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Nox_firegalaxy » Sun Jun 17, 2012 4:27 am

Hi,

is it possible that with "groups-mask" enabled BulletGhostNodes are not affected by the set flags? Because if i replace the BulletGhostNode with BulletRigidBodyNode the collision is dropped correctly but i cannot use BulletRigidBodyNode because i get bounceeffects on my triggervolumes realized with BulletGhostNode.
Nox_firegalaxy
 
Posts: 120
Joined: Wed Jun 23, 2010 2:16 pm

Postby redpanda » Sat Jun 30, 2012 3:40 am

Is it possible to use Bullet only for colision detection for the floor and wall, without the physics?
redpanda
 
Posts: 426
Joined: Wed Aug 03, 2011 6:34 am

Postby GrizzLyCRO » Sun Jul 01, 2012 2:37 pm

In theory if you use ghost objects, they should be only checked for collisions, no much sense to simulate ghosts?
User avatar
GrizzLyCRO
 
Posts: 301
Joined: Tue Dec 16, 2008 4:03 pm
Location: Croatia

Postby enn0x » Sat Jul 07, 2012 5:34 pm

Sorry for the long delay. We had a very very busy time at work, and I din't even turn on my computer when getting home late in the evening. But back again now. I try to catch up with all the posts regarding Bullet the next days.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby enn0x » Sat Jul 07, 2012 5:39 pm

Nox_firegalaxy wrote:Hi,

is it possible that with "groups-mask" enabled BulletGhostNodes are not affected by the set flags? Because if i replace the BulletGhostNode with BulletRigidBodyNode the collision is dropped correctly but i cannot use BulletRigidBodyNode because i get bounceeffects on my triggervolumes realized with BulletGhostNode.

Hmm... I didn't know this so far. But you are right. Since our filter callbacks make no difference between rigid bodies or ghost objects it must be Bullet itself. So far I don't see a workaround, but I keep it in mind. Maybe I stumble over some info in future.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby enn0x » Sat Jul 07, 2012 5:42 pm

redpanda wrote:Is it possible to use Bullet only for colision detection for the floor and wall, without the physics?

Bullet itself can be used as a collision-only engine, but the way we have integrated Bullet with Panda3D does not support this. Sorry.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Nox_firegalaxy » Mon Jul 09, 2012 1:32 pm

well ghosts have no physical response so one can use them for pure collision detection, cannot one?
Nox_firegalaxy
 
Posts: 120
Joined: Wed Jun 23, 2010 2:16 pm

Postby enn0x » Tue Jul 10, 2012 8:01 am

Nox_firegalaxy wrote:well ghosts have no physical response so one can use them for pure collision detection, cannot one?

Yes, this is possible. I mean I have not tried it myself, but I see n reason why this should not work. However, it would also be possible to create plain rigid bodies and use
Code: Select all
body = BulletRigidBodyNode('...')
body.setCollisionResponse(False)

This raises/clears the btCollisionObject::CF_NO_CONTACT_RESPONSE flag, which controls if a collision object should not only detect collisions, but also respond to collisions. At least if I understand the Bullet API right.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby preusser » Tue Jul 10, 2012 11:55 am

But with Ghosts you will just get something like Panda's CollisionHandlerEvent/Queue. You will need to manually calculate wall sliding and keeping the node in the floor, right?
preusser
 
Posts: 520
Joined: Sun Mar 27, 2011 10:07 am

Postby enn0x » Tue Jul 10, 2012 3:45 pm

preusser wrote:But with Ghosts you will just get something like Panda's CollisionHandlerEvent/Queue. You will need to manually calculate wall sliding and keeping the node in the floor, right?

Yes, of course. If you use Bullet only for collision detection you have to handle collision response yourself. No matter if you use ghosts or disable collision response for rigid bodies. But this has been the original question by redpanda - if it is possible to have collision detection without the collision handling (aka physics).
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Nox_firegalaxy » Tue Jul 10, 2012 5:21 pm

to the best of my knowledge the setCollisionResponse flag deactivates the automatic handle by the queue handler too. So this is no real option (i already tested this to get something like triggervolume but switched to ghosts then).
Nox_firegalaxy
 
Posts: 120
Joined: Wed Jun 23, 2010 2:16 pm

Postby enn0x » Tue Jul 10, 2012 5:38 pm

The automatic handle by the queue handler? Sorry, but you lost me now. Are you attempting to mix Bullet collision/physics with Panda3D's built-in collision handlers?
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Nox_firegalaxy » Wed Jul 11, 2012 3:14 am

Sorry I just mixed up things. I mean the doPhysics + getManifolds/in-out-event way of collision handling.
Nox_firegalaxy
 
Posts: 120
Joined: Wed Jun 23, 2010 2:16 pm

Postby enn0x » Thu Jul 12, 2012 5:06 am

I'm not sure if this is right. Even objects with collision response disabled should (1) create persistent manifold points, and (2) generate collision notification messages. But I have to verify this when at home (either this evening or tomorrow).

Might be that both ways don't create identical results (something which hopefully is fixed when upgrading to Bullet 2.80, see coppertops thread about Bullet KKC).
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby enn0x » Thu Jul 12, 2012 2:36 pm

This is what I used for testing:
Code: Select all
  def update(self, task):
    dt = globalClock.getDt()
    self.processInput(dt)
    self.world.doPhysics(dt, 10, 0.008)
    print self.world.getManifolds()
    return task.cont

  def cleanup(self):
    self.world = None
    self.worldNP.removeNode()

  def onContactAdded(self, node1, node2):
    print 'ADDED:', node1, node2

  def onContactDestroyed(self, node1, node2):
    print 'DESTROYED:', node1, node2

  def setup(self):
    self.worldNP = render.attachNewNode('World')

    # World
    self.debugNP = self.worldNP.attachNewNode(BulletDebugNode('Debug'))
    self.debugNP.show()

    self.world = BulletWorld()
    self.world.setDebugNode(self.debugNP.node())

    # Sphere 1
    shape = BulletSphereShape(0.6)
    np = self.worldNP.attachNewNode(BulletRigidBodyNode('S1'))
    np.node().setMass(1.0)
    np.node().addShape(shape)
    np.node().setDeactivationEnabled(False)
    np.setPos(3, 0, 0)
    np.setCollideMask(BitMask32.allOn())
    np.node().setCollisionResponse(False)
    np.node().notifyCollisions(True)
    self.world.attachRigidBody(np.node())

    self.body = np.node()

    # Sphere 2
    shape = BulletSphereShape(0.6)
    np = self.worldNP.attachNewNode(BulletRigidBodyNode('S2'))
    np.node().setMass(1.0)
    np.node().addShape(shape)
    np.setPos(-3, 0, 0)
    np.setCollideMask(BitMask32.allOn())
    np.node().setCollisionResponse(False)
    np.node().notifyCollisions(True)
    self.world.attachRigidBody(np.node())

    # Enable contact reporting
    self.accept('bullet-contact-added', self.onContactAdded)
    self.accept('bullet-contact-destroyed', self.onContactDestroyed)

Only the relevant part of the script. Two bodies, each with disababled collision response. And this is the output I get for a single pass of sphere-1 through sphere-2:
Code: Select all
[]
[]
[]
[]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
ADDED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -2.0112 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

[<libpandabullet.BulletPersistentManifold object at 0x031878F0>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031878F0>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031878F0>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
ADDED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -3.1344 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[]
DESTROYED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -4.4304 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

DESTROYED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -4.4304 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

[]
[]
[]
[]

You see I get a persistent manifold point between the two objects (so the "world.getManifolds" way is working. Just keep in mind that a manifold is created as soon as their bounding boxes overlap. And I get collision events.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby Nox_firegalaxy » Fri Jul 13, 2012 12:24 pm

I beg your pardon. Seems like memory betrayed me but I was sure that my attempt to simulate a triggervolume with disabled bodies failed. I apologize for inconvenience.
Nox_firegalaxy
 
Posts: 120
Joined: Wed Jun 23, 2010 2:16 pm

Postby enn0x » Sun Jul 15, 2012 4:03 am

No need to be sorry. I feel very uneasy with regard to Bullet's collection reporting. There is another thread currenty where coppertop found that there are duplicated manifold points created, and despite the fact that this behaviour seems to be gone if using current Bullet version (2.80) I don't want to claim that there is no bug on our side.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

Postby preusser » Wed Aug 01, 2012 7:48 am

I'm really confused with the BulletConeTwiseConstraint.
After reading the manual page, I still don't get what the TransformStates are used for, as well as swing1, swing2 and twist values. Are those respectively heading, pitch and roll of the first node the other rotates around?
preusser
 
Posts: 520
Joined: Sun Mar 27, 2011 10:07 am

Postby Hovis » Wed Aug 01, 2012 4:18 pm

I have spent a stupidly long time trying to figure out how to get collision events from bullet.

I found this on page 9 of this thread:
enn0x wrote:
enn0x wrote:@Nox_firegalaxy

Nox_firegalaxy wrote:
Hi, am I blind or is there no way to get an event if two objects collided? Im used to the ODE setCollisionEvent but to the best of my knowledge i would have to call getOverlappingNodes on ghosts and contactTest for rigid/dynamics. Is that correct? Is not there a way to get an event per collision if a doPhysics or a informAboutCollisions is called?

There is, but it is currently disabled. However, the API for this is still present (body.noftiyCollisions, then accept the "bullet-contact-added" etc. events).

I should mention how to enable this feature. But I think this is not exactly what you are looking for. A event is created each time a contact point is created.

Code: Select all
# enable contact events
from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'bullet-enable-contact-events true')

# activate generation of contact events for one body
body.notifyCollisions(True)

# listen for events
self.accept('bullet-contact-added', self.doAdded)
self.accept('bullet-contact-destroyed', self.doDestroyed)

# finally the event handlers
def doAdded(self, node1, node2):
  print 'added:', node1.getName(), node2.getName()

def doDestroyed(self, node1, node2):
  print 'destroyed:', node1.getName(), node2.getName()


Please keep in mind that:
1.) More than one contact point can be created for two bodies touching each other.
2.) Contact points can get created and removed again and again while the bodies "slide" against each other.


Is all of this still true?

If I'm understanding you correctly, I can turn on collision notification but I will get events published for each of your internally calculated contact points; potentially seeing many many notifications for each collision.

Getting some nice logical collision events would be super cool.

If you're busy working on other features, how can I help make this happen? I've got a project I'm currently working on and I need this functionality, faking it in my python will be far too slow.
Hovis
 
Posts: 5
Joined: Mon Jul 23, 2012 10:00 am

Postby enn0x » Wed Aug 01, 2012 5:55 pm

preusser wrote:I'm really confused with the BulletConeTwiseConstraint.
After reading the manual page, I still don't get what the TransformStates are used for, as well as swing1, swing2 and twist values. Are those respectively heading, pitch and roll of the first node the other rotates around?

Welcome to Bullet. To be honest I never managed myself to fully understand the effect of those values, but they have been easy to wrap.

Ok, so here is what I know: Constraints have some "location" where the two bodies are connected. This location does not have to be inside or on the surface of either of the two bodies. Depending on the type of constraint it could be a point (e.g. ball and socket), or a line (e. g. hinge or piston).

Now the TransformStates given in the constructor are the transform to this connection point/line, given inside the local reference frames of each boy. Or looking at it the other way: when starting at the connection point/line they are the inverse transform to the two bodies.

Be aware that a TransformState does not only have an rotation (heading/pitch/yaw), but also a translation (x/y/z). Scale and shear are not used here.
enn0x
 
Posts: 1356
Joined: Wed Nov 08, 2006 1:39 am
Location: Germany, Munich

PreviousNext

Return to Panda Features in Development

Who is online

Users browsing this forum: No registered users and 0 guests