首先贴一段代码:
from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
import random
class Application(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.cam.setPos(0,-50,10)
self.setupCD()
self.addSmiley()
self.addFloor()
taskMgr.add(self.updateSmiley,"UpdateSmiley")
#add the method that initializes the collision detection system
def setupCD(self):
'''
base is the __builtin__ variable
'''
base.cTrav=CollisionTraverser()
base.cTrav.showCollisions(render)
self.notifier=CollisionHandlerEvent()
self.notifier.addInPattern("%fn-in-%in")
self.accept("f