Panda Bullet


#66

I still dont know how to build this with waf. Ive never used waf. Installed it in Windows. Now what? This page code.google.com/p/waf/wiki/UsingWaf says I shoud execute these 3 commands:

waf configure
waf build
waf install

Is that how I should do it? Or with the bat file in the libpandabullet folder?


#67

Hi, I just built it on Linux (32) and I built it (after compile bullet) I ran:

python waf configure
python waf build

And then I just copied built/libpandabullet.so (in your case .dll) to the test directory…

You may have to rename the dll to a .pyd on windows.

Enn0x, I dunno if it works for you, the 09_Character.py (or whatever the character controller test is named) segmentation faults for me.
I used the latest bullet SVN revision… and it compiled without doubt… any luck for me?

:smiley:
~powerpup118


#68

@anon

Now you do exactly as this page says: you open a command shell, change directory to wherever you unpacked libpandabullet, and run the three commands.

I don’t know what you mean when you say you have installed waf. You don’t need to install waf! The complete build system is contained in one single file: “waf”.

The .bat file is there for just one purpose: because Windows doesn’t support the so called shebang. This is nothing obscene - look it up on wikipedia. The .bat file does nothing but call "python waf ".

Please not that you have to adjust the path setting withing the file “wscript”. You have to set the path to your Panda3d 1.7.1 installation, to your VS2008 & Windows SDK, and the path to where you have compiled Bullet libs.

Oh, and no grantee that it will compile or run on 64 bit Windows. I don’t have a 64 bit Windows, so I can’t test or fix anything.


#69

@powerpup118

Thank you very much, and glad you like it so far.
About integrating with Panda3D source code, well, original plans have been to introduce Bullet support with Panda3D 2.0. I am still not sure if the code is stable already, and there might be one more complete rewrite. so I’m afraid it will be too late for 1.7.1. The odd releases usually don’t introduce new features, so maybe 1.7.2 or 1.8.0.

About the issue with the character demo: This is a bug in Bullet itself. If you compile Bullet yourself you should patch the source code. See panda3d.org/forums/viewtopi … 6858#66858 for a link to the Bullet forums (yes, it’s a know bug in Bullet).

Basically you edit one file, src/BulletDynamics/Character/btKinematicCharacterController.cpp. In line 87 you add “convexResult”, changing the line from

hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()...

to

hitNormalWorld = convexResult.m_hitCollisionObject->getWorldTransform().getBasis()...

Then compile Bullet and libpandabullet, and the character demo should work well too. I hope this bug will be fixed soon within Bullet source code, since it is quite annoying to patch the code each time I get a new revision of the Bullet source code. But I’m afraid the character controller doesn’t have high priority for Bullet developers.


#70

@enn0x: okay, doesnt sound that hard, but wouldnt a README in the archive help?

As for adding it to Panda 2.0, rdb and drwr both said it is in years to come, so I dont see any logic in not adding anything to the current Panda versions.
Its like if Blender Foundation wouldnt add any new features to Blender since 2007 because they started working on a rewrite ( 2.5).
From what I know, if its added to the svn, its added to the snapshot builds.


#71

1.8.0 might sound like a nice release to put this in. In general, we try to only bring major new features like these in x.x.0 releases.


#72

I think in the mean time we could…

A. Compile it for Mac, or maybe we just leave this to whoever packages 1.8.0?

B. Perhaps the Bullet development team will accept a unix patch file if we gen one?

C. Maybe we could package this into OS-dependant p3d files (so that it’d work in the runtime for 1.7.1), in fact I will probably begin to try and do this

@Enn0x: Thank you for the tip on how to fix the segmentation fault! I will test it asap and see if I still have problems


#73

A. That’d probably be me. I’ll definitely look into compiling it for the Mac when it gets integrated into Panda3D, if nobody else did it before then.

C. As soon as it gets integrated into Panda3D, there will be a bullet package on the official runtime distribution hosts.


#74

About the 64 bit thing, I run 64 bit Windows 7, and it works perfectly fine for me.


#75

Hey, what would be the best way of getting the class instance that a collision ray is colliding with?

I need this so I can call a function on this instance when ever someone clicks it with the mouse.


#76

problem! what did i do wrong?

c:\Panda3D-1.7.0\bullet\libpandabullet>python waf configure
Setting top to                           : c:\Panda3D-1.7.0\bullet\libpandabulle
t
Setting out to                           : c:\Panda3D-1.7.0\bullet\libpandabulle
t\built
Checking for 'msvc' (c++ compiler)       : ok
'configure' finished successfully (0.440s)

c:\Panda3D-1.7.0\bullet\libpandabullet>python waf build install clean
Waf: Entering directory `c:\Panda3D-1.7.0\bullet\libpandabullet\built'
[1/6] libbullet_igate.cxx libbullet.in: src\bulletAllHitsRayResult.h src\bulletB
ody.h src\bulletBoxShape.h src\bulletCapsuleShape.h src\bulletCharacterControlle
rNode.h src\bulletClosestHitRayResult.h src\bulletClosestHitSweepResult.h src\bu
lletConeShape.h src\bulletConeTwistConstraint.h src\bulletConstraint.h src\bulle
tContactCallbacks.h src\bulletContactResult.h src\bulletConvexHullShape.h src\bu
lletConvexPointCloudShape.h src\bulletCylinderShape.h src\bulletDebugNode.h src\
bulletDistanceConstraint.h src\bulletGenericConstraint.h src\bulletGhostNode.h s
rc\bulletHeightfieldShape.h src\bulletHelper.h src\bulletHingeConstraint.h src\b
ulletManager.h src\bulletManifoldPoint.h src\bulletPersistentManifold.h src\bull
etPlaneShape.h src\bulletRigidBodyNode.h src\bulletShape.h src\bulletSliderConst
raint.h src\bulletSoftBodyConfig.h src\bulletSoftBodyHelper.h src\bulletSoftBody
Node.h src\bulletSoftBodyShape.h src\bulletSoftBodyWorldInfo.h src\bulletSphereS
hape.h src\bulletTriangleMesh.h src\bulletTriangleMeshShape.h src\bulletVehicle.
h src\bulletWheel.h src\bullet_includes.h src\bullet_symbols.h src\bullet_utils.
h src\config_bullet.h -> built\libbullet_igate.cxx built\libbullet.in
    *** Error in bullet_utils.h near line 31, column 73:
    parse error
Error parsing file: 'bulletAllHitsRayResult.h'
Waf: Leaving directory `c:\Panda3D-1.7.0\bullet\libpandabullet\built'
Build failed
 -> task failed (exit status 1):
        {task 45373456: libbullet_igate.cxx libbullet.in bulletAllHitsRayResult.
h,bulletBody.h,bulletBoxShape.h,bulletCapsuleShape.h,bulletCharacterControllerNo
de.h,bulletClosestHitRayResult.h,bulletClosestHitSweepResult.h,bulletConeShape.h
,bulletConeTwistConstraint.h,bulletConstraint.h,bulletContactCallbacks.h,bulletC
ontactResult.h,bulletConvexHullShape.h,bulletConvexPointCloudShape.h,bulletCylin
derShape.h,bulletDebugNode.h,bulletDistanceConstraint.h,bulletGenericConstraint.
h,bulletGhostNode.h,bulletHeightfieldShape.h,bulletHelper.h,bulletHingeConstrain
t.h,bulletManager.h,bulletManifoldPoint.h,bulletPersistentManifold.h,bulletPlane
Shape.h,bulletRigidBodyNode.h,bulletShape.h,bulletSliderConstraint.h,bulletSoftB
odyConfig.h,bulletSoftBodyHelper.h,bulletSoftBodyNode.h,bulletSoftBodyShape.h,bu
lletSoftBodyWorldInfo.h,bulletSphereShape.h,bulletTriangleMesh.h,bulletTriangleM
eshShape.h,bulletVehicle.h,bulletWheel.h,bullet_includes.h,bullet_symbols.h,bull
et_utils.h,config_bullet.h -> libbullet_igate.cxx,libbullet.in}
' interrogate -srcdir ../src -I../src -Dvolatile -Dmutable -DCPPPARSER -D__STDC_
_=1 -D__cplusplus -D__inline -longlong __int64 -D_X86_ -DWIN32_VC -D_WIN32 -D_MS
C_VER=1500 -D"_declspec(param)=" -D_near -D_far -D__near -D__far -D__stdcall -DF
ORCE_INLINING -oc libbullet_igate.cxx -od libbullet.in -fnames -string -refcount
 -assert -python-native -S"../src/parser-inc" -S"C:\\Program Files/Panda3D-1.7.1
/include" -S"C:\\Program Files/Panda3D-1.7.1/include/parser-inc" -DBUILDING_PAND
ABULLET -module pandabullet -library libbullet bulletAllHitsRayResult.h bulletBo
dy.h bulletBoxShape.h bulletCapsuleShape.h bulletCharacterControllerNode.h bulle
tClosestHitRayResult.h bulletClosestHitSweepResult.h bulletConeShape.h bulletCon
eTwistConstraint.h bulletConstraint.h bulletContactCallbacks.h bulletContactResu
lt.h bulletConvexHullShape.h bulletConvexPointCloudShape.h bulletCylinderShape.h
 bulletDebugNode.h bulletDistanceConstraint.h bulletGenericConstraint.h bulletGh
ostNode.h bulletHeightfieldShape.h bulletHelper.h bulletHingeConstraint.h bullet
Manager.h bulletManifoldPoint.h bulletPersistentManifold.h bulletPlaneShape.h bu
lletRigidBodyNode.h bulletShape.h bulletSliderConstraint.h bulletSoftBodyConfig.
h bulletSoftBodyHelper.h bulletSoftBodyNode.h bulletSoftBodyShape.h bulletSoftBo
dyWorldInfo.h bulletSphereShape.h bulletTriangleMesh.h bulletTriangleMeshShape.h
 bulletVehicle.h bulletWheel.h bullet_includes.h bullet_symbols.h bullet_utils.h
 config_bullet.h bullet_composite.cxx '

c:\Panda3D-1.7.0\bullet\libpandabullet>

#77

I had that problem, I think I had to download and install bullet onto my PC… google it, lemme know if it works
~powerpup118


#78

The object which has been hit by the ray can be accessed via “getNode”. When testing for a single hit (rayTestClosest):

result = mgr.rayTestClosest(...)
node = result.getNode()

And when testing for all hits (rayTestAll):

result = mgr.rayTestAll(...)
for hit in result:
    node = hit.getNode()

The returned object is one of the libpandabullet nodes, e. g. BulletRigidBodyNode.

To get the type of this node you can use the standard Python “type()” method, and you can also use the PandaNode tags or python tags to store additional information on the node when creating it.


#79

Impossible to say with the few information provided. But, like powerpup118 suggested, the most likely reason is that you forgot to download and compile Bullet. Open the “wscript” file and make sure that all paths are valid on your computer, especially the ones who point to your Bullet libraries:

    # Bullet
    ctx.env.append_unique('INCLUDES',
      'C:/Libraries/bullet-r2269/src')
    ctx.env.append_unique('INCLUDES',
      'C:/Libraries/bullet-r2269')
    ctx.env.append_unique('LIBPATH',
      'C:/Libraries/bullet-r2269/msvc/2008/lib/Release')

If not modify them to match your needs.

By the way: Is there a particular reason why you try to compile yourself? Oh, and if you download the Bullet sources yourself make sure you apply the above mentioned fix to src/BulletDynamics/Character/btKinematicCharacterController.cpp.


#80

I didnt see an installer, is there one?


#81

How would I create and access these tags? Sorry, but I have never used such things before.


#82

Like this (or look into the NodePath API)

np.setPythonTag('myAmazingClass', myRealClass)
...later...
myRealClass = np.getPythonTag('myAmazingClass')

you can store python objects in the nodepath, and retrieve them later.
Hope this helps
~powerpup118


#83

No. I don’t see any need for an installer. Just copy the library (.pyd) to whereever you develop your game.


#84

Some more info: There are two “tag” systems, the C++ tags (setTag, getTag) and the Python tags (setPythonTag, getPythonTag). The C++ tags are basically a dictionary with string keys and string values, and the Python tags are a dictionary with string keys and PyObject values.


#85

i did this and when i try and run the first test file (01_Basics.py) i get

DirectStart: Starting the game.
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "01_Basics.py", line 20, in <module>
    from libpandabullet import BulletManager
ImportError: DLL load failed: The specified procedure could not be found.

i copied the manifest, the PYD and the SO into python’s library/site-packages folder, without putting it into any other folder