Filed in: Resources.ProgrammingCodeSnippletsSetCameraPositionWithEnabledMouse · Modified on : Fri, 31 Jul 09
from pandac.PandaModules import Mat4, Point3 def setMouseEnabledPosHpr( position, rotation ): # set a default camera position camera.setPos(position) camera.lookAt(render) camera.setHpr(camera, rotation) cameraMat=Mat4(camera.getMat()) cameraMat.invertInPlace() base.mouseInterfaceNode.setMat(cameraMat) def setMouseEnabledPosLookAt( position, lookAt ): # set a default camera position camera.setPos(position) camera.lookAt(render, Point3(lookAt)) #camera.setHpr(camera, rotation) cameraMat=Mat4(camera.getMat()) cameraMat.invertInPlace() base.mouseInterfaceNode.setMat(cameraMat)