Animated Mesh Looping Problem

Blitz3D Forums/Blitz3D Beginners Area/Animated Mesh Looping Problem

Paragon(Posted 2007) [#1]
I'm having some trouble getting a simple animated mesh to loop properly. I created some fan blades in 3ds max and created a 60 frame animation such that the fan blades would rotate 360 degrees over these 60 frames. The preview animation looks great in max, but when I export the file to .B3D format (by first exporting from max to UU3D in its native format (.U3D), then using UU3D to export the file as B3D), there’s a noticeable pause at the end of the animation sequence each time prior to the loop repeating. I initially thought that this was due to specifying a full 360 degree rotation in max, such that frame 0 and frame 59 represented the same rotation (although this seems to work perfectly well for max). So I then deleted the last frame and made the final rotation equal to 354 degrees (each frame being 6 degrees), but this also yielded a similar pause before the animation repeats. I messed around with changing the tween value for both scenarios, but to no avail. Here's the animation code I used:
Graphics3D 1024, 768, 32, 1

mesh=LoadAnimMesh( "fan.b3d" )
PositionEntity mesh, -150, -150, 0

cam=CreateCamera()
PositionEntity cam, 0, 0, -200

light=CreateLight()
RotateEntity light, 45, 45, 0

PointEntity cam, mesh

Animate mesh, 1, 0.1, 0, 2

While Not KeyHit( 1 )

	UpdateWorld
	RenderWorld
	Flip
	
Wend

End


If anyone has some insight into why this is happening and how to resolve it, your assistance would be greatly appreciated.


jhocking(Posted 2007) [#2]
I wouldn't be looking at the code, I would be looking at the model itself for what's wrong with the animation. For example, you said the animation looks fine in 3ds max, but what about in Ultimate Unwrap?

That said, you could probably use ExtractAnimSeq to trim off the last few frames (ie. the pause in the animation.)


Paragon(Posted 2007) [#3]
The pause is also evident in UU3D, and in the both of the scenarios that I described in my original post.

I guess I don't understand how removing the last few frames of the animation would solve the problem, since the animation represents a complete 360 degree rotation.


stayne(Posted 2007) [#4]
If you want, email me the fan and I'll look at it for you.


jhocking(Posted 2007) [#5]
Well if the problem is evident in Ultimate Unwrap, that means there are a few blank frames at the end which I was suggesting trimming off. In short, the pause is actually part of the animation, and I'm suggesting removing that end bit of the animation.

Imagine if in 3ds max at the end of the animation, after the fan turns 360, there are a few more frames of nothing before the animation loops.

I don't know why exactly that is happening, but that's because I've never used the UU exporter for 3ds max. I'm guessing you are exporting a few additional frames without realizing it; perhaps the exporter has a setting for what frames to include.


Paragon(Posted 2007) [#6]
Joe, it was as you thought—the UU3D exporter for max apparently (and seemingly inappropriately) added one additional frame to the overall length of the animation sequence. This was easily corrected with UU3D’s Animation Editor.

The Animation Editor has editable fields for fps, start frame and length, and a computed field for the end frame. Looking at the freshly exported model, the start frame was set to 0 and the length was set to 60; however, the end frame was also set to 60 instead of 59. Changing the length to 59 resulted in the end frame changing to 59 as well (I would think that a length of 60 would have an end frame of 59, assuming a start frame of 0). Upon testing it, the pause was gone and the animation was perfectly smooth.

Thank you for your help in isolating this problem.


IPete2(Posted 2007) [#7]
I have a crazy idea

- why not just rotate the entity? If its a standard rotate your can start - speed up - have a gentle wind down and a stop and looping wont ever be a problem.

IPete2.