fish will not animate (swim)

skorpio

08-12-2006 08:17:39

Hello

I'm trying to get the fish.mesh to animate but I can't get it to move quite right.
This code was basically isolated from a demo that shows pyogre+pygame. The demo worked fine under pyogre 1.0 version but
when I tried it with pyogre 1.2, the fish did not swim at all.
So I stripped everything down to the simplest and I got the same behavior.


# create fish entity
entity = sceneManager.createEntity('Wanda', 'fish.mesh')
fishNode = sceneManager.rootSceneNode.createChildSceneNode("fishNode",ogre.Vector3(0,0,0))
fishNode.scale = 5.0,5.0,5.0
fishNode.attachObject(entity)
self.animationStates.append(entity.getAnimationState('swim'))
self.animationStates[-1].enabled = True
self.animationSpeeds.append(ogre.Math.RangeRandom(0.5, 1.5))

Here I'm creating a fish X5 its size


#create fish swiming path
fishNode = sceneManager.rootSceneNode.createChildSceneNode("fishAnimNode")
animation = sceneManager.createAnimation('fishTrack', 10)
animation.interpolationMode = ogre.Animation.IM_SPLINE
animationTrack = animation.createNodeTrack(0, fishNode)
key = animationTrack.createNodeKeyFrame(0)

key = animationTrack.createNodeKeyFrame(1)
key.translation = 80.0, 0.0, -40.0
key = animationTrack.createNodeKeyFrame(2)
key.translation = 120.0, 0.0, 0.0
key = animationTrack.createNodeKeyFrame(3)
key.translation = 80.0, 0.0, 80.0
key = animationTrack.createNodeKeyFrame(5)
key.translation = -80.0, 0.0, -40.0
key = animationTrack.createNodeKeyFrame(6)
key.translation = -120.0, 0.0, 0.0
key = animationTrack.createNodeKeyFrame(7)
key.translation = -80.0, 0.0, 100.0
key = animationTrack.createNodeKeyFrame( 8 )
key.translation = 30.0, 0.0, 90.0
key = animationTrack.createNodeKeyFrame(9)
key.translation = -20.0, 0.0, 40.0
key = animationTrack.createNodeKeyFrame(10)
key.translation = 0.0, 0.0, 0.0

fishAnimationState = sceneManager.createAnimationState('fishTrack')
self.animationStates.append(fishAnimationState)
self.animationStates[-1].enabled = True
self.animationSpeeds.append(ogre.Math.RangeRandom(0.5, 1.5))

Here I'm creating a swiming path for the fish.

What I get is this:

1) The fish is 5x its size and the fish moves just its tails but it doesn't follow the swiming path at all.

2) If the line in BOLD is comment it out, then the fish is really small and it does follow the swiming path. It doesn't matter how mush I scale the fish. It just doesn't get bigger.


I have spent all afternoon to try to understand why I get this behavior but I was unable to get the fish 5x to follow a path

Any help is appreciated

Thanks