Any help here would be greatly appreciated.
The workflow is as follows.
I set up the scene (game matrix, rootnode, local_srt)
I bring in the model and make the cloth part a seperate object.
I add cloth simulation to it and add wind force to the scene.
I then create the armature (I don’t bind it to the flag yet), I then use constraints to bind the armature to specific vertices of the flag object. This is all done so that the wind simulation moves cloth, and the vertices of the cloth in turn move the armature since it is constrained to it.
At this point I play around with the wind simulation, I don’t want randomness to the wind strength or its location since I need to find a loop. This happens around 200 to 400 frames into the simulation. Here I keyframe the armature.
At this point I have an armature that loops like a semi realistic wind.
I clean the scene, remove the wind and cloth modifiers and even the model.
I bring in the model again of the banner and align it with the armature.
Here starts the Grimrock part.
I create vertex groups that correspond with the names of the bones from the armature. If I play the animation the vertex groups move alone with the bone. At this point I wish I could just save the model and animation with bitcpy script, but it’s missing the empties.
I added the empties to the bone location and named them the same as the bones. This allowed me to export without errors both the model and the animation. At first I thought this was working (I was wrong).
In game the object was working, the animation was playing onInit and everything seemed ok. If I moved out of the update range the animation freezes on the current frame and resumes when entering the update range again.
The error is when the object spawns outside the update range, or if the player has never moved into the update range to trigger onInit play Then it’s all messed up.
I imported the model file back into Blender and it was all messed up, (it was correct in edit mode and pose).
At first I thought it was because I had not exported the model in rest mode, but it seems not to matter if you choose rest or pose mode during export.
I later found out that “rest” mode of the model seems to be derived from the empties, all the bones take the rotation values of the empties, but are corrected when the animation starts to play. So here I need to find the rotation values of the bones, and set those to the empties, any help automatic this would be awesome.
( I have never understood why the empties are needed in the first place, but that's the LoG format I guess).