Merry Christmas,
Yes, I thought so that the demos may not be stable, but I wanted to
have it confirmed. Thanks.
Where I first saw the problem was in the tutorial 4 of the wiki:
http://wiki.python-ogre.org/index.php/Basic_Tutorial_4
At the point the keyboard and mouse are captured, I was expecting to
not be able to move anymore but it when the bug appeared.
If I may, this is my source code:
#**************************************************************
import ogre.renderer.OGRE as ogre
import ogre.io.OIS as OIS
import SampleFramework as sf
class TutorialFrameListener(sf.FrameListener):
def __init__(self, renderWindow, camera, sceneManager):
sf.FrameListener.__init__(self, renderWindow, camera)
self.toggle = 0
self.mouseDown = False
self.camNode = camera.parentSceneNode.parentSceneNode
self.sceneManager = sceneManager
self.rotate = 0.13
self.move = 250
def frameStarted(self, frameEvent):
if(self.renderWindow.isClosed()):
return False
self.Keyboard.capture()
self.Mouse.capture()
currMouse = self.Mouse.getMouseState()
if currMouse.buttonDown(OIS.MB_Left) and not self.mouseDown:
light = self.sceneManager.getLight('Light1')
light.visible = not light.visible
self.mouseDown = currMouse.buttonDown(OIS.MB_Left)
if self.toggle >= 0:
self.toggle -= frameEvent.timeSinceLastFrame
if self.toggle < 0 and self.Keyboard.isKeyDown(OIS.KC_1):
self.toggle = 0.1
self.camera.parentSceneNode.detachObject(self.camera)
self.camNode = self.sceneManager.getSceneNode("CamNode1")
self.sceneManager.getSceneNode("PitchNode1").attachObject
(self.camera)
elif self.toggle < 0 and self.Keyboard.isKeyDown(OIS.KC_2):
self.toggle = 0.1
self.camera.parentSceneNode.detachObject(self.camera)
self.camNode = self.sceneManager.getSceneNode("CamNode2")
self.sceneManager.getSceneNode("PitchNode2").attachObject
(self.camera)
return not self.Keyboard.isKeyDown(OIS.KC_ESCAPE)
class TutorialApplication(sf.Application):
def _createScene(self):
sceneManager = self.sceneManager
sceneManager.ambientLight = 0.25, 0.25, 0.25
entity = sceneManager.createEntity('Ninja', 'ninja.mesh')
node = sceneManager.getRootSceneNode().createChildSceneNode
('NinjaNode')
node.attachObject(entity)
light = sceneManager.createLight('Light1')
light.type = ogre.Light.LT_POINT
light.position = 250, 150, 250
light.diffuseColour = 1, 1, 1
light.specularColour = 1, 1, 1
node = sceneManager.getRootSceneNode().createChildSceneNode
('CamNode1', (-400, 200, 400))
node.yaw(ogre.Degree(-45))
node = node.createChildSceneNode('PitchNode1')
node.attachObject(self.camera)
node = sceneManager.getRootSceneNode().createChildSceneNode
('CamNode2', (0, 200, 400))
node.createChildSceneNode('PitchNode2')
def _createCamera(self):
self.camera = self.sceneManager.createCamera('PlayerCam')
self.camera.nearClipDistance = 5
def _createFrameListener(self):
self.frameListener = TutorialFrameListener(self.renderWindow,
self.camera, self.sceneManager)
self.root.addFrameListener(self.frameListener)
self.frameListener.showDebugOverlay(True)
if __name__ == '__main__':
try:
ta = TutorialApplication()
ta.go()
except ogre.OgreException, e:
print e
#***********************************************************************
I still try to find others demos that use SampleFramework and override
the keys/mouse, but no luck so far.
But thanks already for your help.
On Dec 25, 12:15 am, "Andy Miller" <
nzmill...@gmail.com> wrote:
> Water demo isn't finished/working and demo_bspcollision doesn't do any
> checking on the camera movement so walking through walls is OK (and while I
> thought I'd fixed the ball issue I may not have - it's related to Ogre's ODE
> support - check the OgreODE demos instead)..
> Can you give an example of other demos that show the sluggish movement you
> are seeing...
>
> Andy
>
> 2008/12/25 Gourry G <
gourry.gabr...@gmail.com>