A problem about pyogre 1.2

nathan75

13-06-2006 14:08:26

My program was working in 1.0.6
but do not work in 1.2.0
the only problem is the bone do not turn or do any action.
I'm not sure why. are there any changes of the method yaw()?

###########################

global direction
global Rada

if direction < 0 and Rada < -0.1:
direction = 1
if direction > 0 and Rada > 1.0:
direction = -1

Rada = Rada+0.1*direction
rad = ogre.Radian(0.1*direction)

bone = skeletons[0].getBone("Bone31")
bone.yaw(rad)

bone = skeletons[0].getBone("Bone04")
rad = ogre.Radian(-0.03*direction)
bone.yaw(rad)


bone = skeletons[0].getBone("Bone23")
rad = ogre.Radian(-0.1*direction)
bone.yaw(rad)

dermont

13-06-2006 19:34:58

Theres been a number of changes in the way that Ogre handles animation, check here:
http://www.ogre3d.org/wiki/index.php/DagonNotes

Maybe if you post the relevant parts of your code someone will be able to help. Here's an example of manually controlling bones, which appears to work correctly, if it's any help:


# This code is in the Public Domain.
from pyogre import ogre
import SampleFramework as sf


class SkeletalApplication(sf.Application):

def _createScene(self):

sceneManager = self.sceneManager
camera = self.camera

ogre.Animation.setDefaultInterpolationMode(ogre.Animation.IM_SPLINE)
sceneManager.ambientLight = (0.5, 0.5, 0.5)

# create entity and enable
entity = sceneManager.createEntity('robot0', 'robot.mesh')
sceneManager.rootSceneNode.createChildSceneNode((0, 0, 0)).attachObject(entity)
entity.getAnimationState('Walk').enabled = True


# get the skeleton instance
skeletonInstance = entity.skeleton
anim = skeletonInstance.getAnimation('Walk')

# define the bones to manually control and destroy the bone's node track
for i in xrange(0,5):
bone = skeletonInstance.getBone(i)
bone.manuallyControlled = True
anim.destroyNodeTrack(bone.handle)

# lights
light = sceneManager.createLight('BlueLight')
light.position = (-200, -80, -100)
light.diffuseColour = (0.5, 0.5, 1.0)
light.position=(9, 0, 0)
light = sceneManager.createLight('GreenLight')
light.position = (0, 0, -100)
light.diffuseColour = (0.5, 1.0, 0.5)

# camera
camera.position = (100, 50, 100)
camera.lookAt(-50, 50, 0)

# Report whether hardware skinning is enabled or not
subEntity = entity.getSubEntity(0)
material = subEntity.material
technique = material.bestTechnique
techniquePass = technique.getPass(0)
if techniquePass.hasVertexProgram and techniquePass.vertexProgram.skeletalAnimationIncluded:
self.renderWindow.debugText = 'Hardware skinning is enabled'
else:
self.renderWindow.debugText = 'Software skinning is enabled'


self.skeleton = skeletonInstance


def _createFrameListener(self):
self.frameListener = SkeletalAnimationFrameListener(self.renderWindow, self.camera,
self.skeleton)
self.root.addFrameListener(self.frameListener)

class SkeletalAnimationFrameListener(sf.FrameListener):
def __init__(self, renderWindow, camera, skeleton):
sf.FrameListener.__init__(self, renderWindow,camera)
self.skeleton = skeleton


def frameStarted(self, frameEvent):
for i in xrange(0,self.skeleton.numBones):
b = self.skeleton.getBone(i)
if b.manuallyControlled:
b.yaw(ogre.Radian(0.707/100.0))
return sf.FrameListener.frameStarted(self, frameEvent)

if __name__ == '__main__':
try:
application = SkeletalApplication()
application.go()
except ogre.OgreException, e:
print e

nathan75

14-06-2006 02:33:52

It is working now.

added a sentence

bone.manuallyControlled = True


thank you very much!