#!/usr/bin/python
#coding:utf8
import sys, os.path
from direct.showbase.ShowBase import ShowBase
from pandac.PandaModules import *
from panda3d.bullet import *
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# 禁用摄像机控制任务。
self.disableMouse()
self.camera.setPos(0,-7,1.1)
debugNode = BulletDebugNode('Debug')
debugNP = render.attachNewNode(debugNode)
debugNP.show()
# 建立 Bullet 的 World
world = BulletWorld()
world.setDebugNode(debugNP.node())
# 建立 Bullet 需要的碰撞对象
shape = BulletSphereShape(3)
node = BulletRigidBodyNode('Joint')
node.addShape(shape)
np = render.attachNewNode(node)
np.setPos(0,0,0)
world.attachRigidBody(node)
rootDir = os.path.abspath(os.path.dirname(sys.argv[0]))
loadPrcFile(os.path.join(rootDir, "Config.prc"))
app = MyApp()
app.run()
But I showed nothing.