dark_sylinc wrote:lunkhound wrote:
Basically can I do the following:
Code: Select all
each frame:
apply_animations_and_update_transforms_on_all_bones();
do_stuff_to_modify_bone_transforms_selectively();
render_scene();
Or something close to that?
More or less that's the idea I have in mind, actually more like:
Code: Select all
each frame:
apply_animations_and_update_transforms_on_all_bones_phase01(); //Local-Bone to Object space
do_stuff_to_modify_bone_transforms_selectively(); //Modify object space
apply_animations_and_update_transforms_on_all_bones_phase02(); //Object space to World-Bone
render_scene();
Keep in mind that the animation update and "do_stuff_to_modify_bone_transforms_selectively" will happen in multiple threads.
Hmmm. So 'do_stuff_to_modify_bone_transfroms_selectively' can't be done in the main thread? I was hoping to do something like the following in that function:
Code: Select all
for each object:
copy bone transforms onto physics constraints or rigid bodies
global_physics_tick(); // this obviously needs to be done from the main thread
for each object:
extract rigid body transforms and put them back onto bones
The way I'm doing this in 1.x is for each Entity, I call "setSkipAnimationStateUpdate( true )" to prevent Ogre from applying animations during the sceneMgr->_renderScene() call. Then I manually apply animations for each entity, read back the bone transforms, feed them into physics, run physics, read the results out of physics and stick them back onto the bones, and finally I call _renderScene().
I don't really need to do this on all of my objects, because this is pretty expensive. I was hoping that with 2.0 and the new animation system I would be able to avoid looping over the Entities and manually applying the animations (with entity->getSkeleton()->setAnimationState( *entity->getAllAnimationStates() )) like I do now.