I decided to try ghost objects to create triggers. However, I’m getting a few problems, let’s start with a strange message when running the simulation.
from direct.showbase.ShowBase import ShowBase
from panda3d.bullet import BulletRigidBodyNode, BulletBoxShape, BulletWorld, BulletGhostNode, BulletDebugNode, BulletPlaneShape
from panda3d.core import Vec3, TransformState, Point3, ClockObject, NodePath
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.bullet_world = BulletWorld()
self.bullet_world.set_gravity(Vec3(0, 0, -9.8))
debug_node = BulletDebugNode('debug')
debug_bullet = NodePath(debug_node)
debug_bullet.reparent_to(render)
debug_bullet.show()
self.bullet_world.set_debug_node(debug_node)
body = BulletRigidBodyNode('body_1')
body.add_shape(BulletBoxShape(Vec3(1, 1, 1)))
body.set_mass(1)
body.set_transform(TransformState.make_pos(Point3(0, 0, 20)))
self.bullet_world.attach_rigid_body(body)
self.trigger = BulletGhostNode('trigger')
shape = BulletPlaneShape(Vec3(0, 0, 1), 0)
self.trigger.add_shape(shape)
self.bullet_world.attach_ghost(self.trigger)
taskMgr.add(self.update, "update")
def update(self, task):
dt = globalClock.get_dt()
self.bullet_world.do_physics(dt)
if self.trigger.get_num_overlapping_nodes() > 0:
pass
#return task.done
return task.cont
app = MyApp()
app.run()
out:
D:\TestBullet>D:\Panda3D-1.10.12-x64\python\python.exe main.py
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:bullet(error): Overflow in AABB, object removed from simulation
:bullet(error): If you can reproduce this, please email bugs@continuousphysics.com
:bullet(error): Please include above information, your Platform, version of OS.
:bullet(error): Thanks.
There is another problem, the ghostly object always shows a collision. Of course, this is not all, there are still surprises, but more about them later…
I think I found that this strange message is related to the debugging node.