problems with the rotations....

pocho

24-10-2006 18:55:10

hello to all. I am new using this game engine.
I was reading the tutorials. and in the final of the tutorial 1 when attempt to modify the angle of the robot, leaves programa. I dont understand because this happens :cry:
here I let to the file log to them with the file beginner_1.py have if somebody can help me.
http://pochoblender.googlepages.com/tuto1.zip

thanks for any aid..
:)

dermont

25-10-2006 00:14:43

There is a problem with the way swig interprets the Degree/Radian typemap in pyOgre. For the moment the problem can be resolved by replacing instances of:

#ogre.Degree(-90)
ogre.Degree(-90).valueRadians()

For beginner_1.py demo:

#node1.yaw(ogre.Degree(-90))
node1.yaw(ogre.Degree(-90).valueRadians())

#node2.pitch(ogre.Degree(-90))
node2.pitch(ogre.Degree(-90).valueRadians())


#node3.roll(ogre.Degree(-90))
node3.roll(ogre.Degree(-90).valueRadians())

pocho

25-10-2006 03:44:31

dermont ,thank you very much by the aid

now it works correctly... :D

dermont

25-10-2006 04:28:54

You're welcome. There is a few more instances of this in the other demos, here are the changes for the other demos.


beginner_2.py
#light.setSpotlightRange(ogre.Degree(35), ogre.Degree(50))
light.setSpotlightRange(ogre.Degree(35).valueRadians(), ogre.Degree(50).valueRadians())

beginner_3.py
#self.sceneManager = self.root.getSceneManager(ogre.ST_EXTERIOR_CLOSE)
self.sceneManager = self.root.createSceneManager("TerrainSceneManager")

beginner_4.py

if inputDevice.getMouseButton(1):
#self.camNode.yaw(ogre.Degree(-self.rotate * inputDevice.mouseRelativeX))
self.camNode.yaw(ogre.Degree(-self.rotate * inputDevice.mouseRelativeX).valueRadians())

#self.camNode.getChild(0).pitch(ogre.Degree(-self.rotate * self.inputDevice.mouseRelativeY))
self.camNode.getChild(0).pitch(ogre.Degree(-self.rotate * self.inputDevice.mouseRelativeY).valueRadians())

#node.yaw(ogre.Degree(-45)) # look at the ninja
node.yaw(ogre.Degree(-45).valueRadians()) # look at the ninja

beginner_5.py
def mouseDragged(self, evt):
self.camNode.yaw(ogre.Degree(-evt.relX * self.rotate))
#self.camNode.getChild(0).pitch(ogre.Degree(-evt.relY * self.rotate))
self.camNode.getChild(0).pitch(ogre.Degree(-evt.relY * self.rotate).valueRadians())

#node.yaw(ogre.Degree(-45)) # look at the ninja
node.yaw(ogre.Degree(-45).valueRadians()) # look at the ninja

pocho

25-10-2006 23:02:55

thank you very much dermont,
now I can continue reading the guide for beginners
all script worked correctly.
i very happy :D :D :D :D