Uv animation problem.

There is this problem I’m having with the UV animation in the BGE. I have the .blend I’m referencing below. Every time I emit the plane with the animated crown texture on it multiple times, The animations will be synchronized. How do I get it to where the the planes animations start at frame 1 each?

Attachments

Myproblem.blend (1.04 MB)

Unfortunately there’s no control over that. You need another approach.

  • All build-in animations for sprite-sheets start at the same moment, when the BGE starts, regardless whether the object is added to the scene or not. So you need to scroll the UV map yourself, with Python.
  • Because you’re adding the same object, you also add the same mesh. That’s why you need Python (LibNew) to make copies of the mesh. Once the object is added, replace the mesh with a copy of the mesh. So now each mesh can have it’s own UV map.

Also you can set Face Orientation to Halo (Material tab) instead of tracking the Camera. Rotate the mesh -90 degrees on the Z-axis.

If you need any help with this, I can take your blend and modify it so it works as intended.

I just recently updated my Sprycle utility. The playback system for the bge is now a simple module (sprycle.py), which has a “simple mode” documented here.

It can be used to do what you want, as you can see in the attached example.

Attachments

sprycle_solution.blend (1.03 MB)

Woah! O.O That’s awesome! Thanks so much Goran! http://resources.guild-hosting.net/20140827880/themes/core/images/smileys/thumbsup.gif

Goran beat me to it while I was working on it. I just thought you might need this. Actually, I don’t know how much different it is from Goran’s sprycle solution, but it’s a bit shorter, so maybe this will help too. (Just so you’d know I downsized your image a bit).

In both solutions there’s only one problem. Cloned meshes with LibNew can’t be freed without Blender crashing. The bug was reported some time ago, but there’s no saying if it will get fixed soon. So for now, we have to settle with a memory leak. With meshes of two polygons it’s hardly noticeable, unless you will clone thousands.

Attachments

UV_animated_00.blend (227 KB)

The sprycle module supports optional frame data, in this format. It also provides additional features, as documented here.

So for now, we have to settle with a memory leak.

True, but you only need to create as many meshes as are actually visible at the same time. The sprycle module is smart enough to cache and re-use meshes. :wink: