[Solved] Ragdoll backto irrlicht animation system

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

[Solved] Ragdoll backto irrlicht animation system

Post by wing64 »

Hi,
When i ran ragdoll simulation if i enable transition and backto irrlicht animation result is very bad (see video)

Ninja with transition. (bad result when back to irrlicht animation)
http://www.youtube.com/watch?v=_XsCG4H4PjA

but i disable transition result is good.

Ninja without transition. (it's ok)
http://www.youtube.com/watch?v=OYV9NCV8EMg

Question is that problem depend on matrix ? Global matrix use when ragdoll simulate and irrlicht animation use local matrix, is'n it ?
I saw Unity AdvancedRagdoll, How should i do this in irrlicht ? Please suggest me.

Unity AdvancedRagdoll.
http://activeden.net/item/advancedragdoll/144172
Last edited by wing64 on Fri Apr 22, 2011 5:17 am, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please show the code snippets which you use to switch to ragdoll and back to Irrlicht animation. I'm not that familiar with the animation system.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I'm not sure either, but I think Luke added the option to use a global matrix when setting the joint positions for this very purpose.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Post by wing64 »

@hybrid: This's ragdoll code switch enable/disable. The key is setSkinningSpace() for use global axis from physx or local axis from skinned mesh.

Code: Select all

void physxmgr_ragdoll_set_simulate_enable_single( ragdoll_t* in_rd, bool enable )
{
	ragdoll_t* rd = in_rd;
	if( !rd || !rd->node )
		return;

	rd->simulate = enable;

	if( !rd->simulate )
	{
	        // restore old rotation when back to irrlicht animation
		rd->node->setRotation( rd->rot );
		rd->node->updateAbsolutePosition( );
		rd->node->setJointMode( EJUOR_CONTROL );
	}
	else
	{
		// FIX use zero transition allway when enable ragdoll
		//rd->node->setTransitionTime( 0 );
		rd->node->setJointMode( EJUOR_CONTROL );
	}

	ragdoll_element_t*	re = NULL;
        // ERDF_COUNT = max number of joint in ragdoll
	for( u32 i = 0; i < ERDF_COUNT; ++i )
	{
		re = &rd->elements[i];
		if( re && re->b0 && re->a0 )
		{
			re->b0->setSkinningSpace( rd->simulate?EBSS_GLOBAL:EBSS_LOCAL );

			if( rd->simulate )
				re->a0->clearBodyFlag( NX_BF_KINEMATIC );
			else
				re->a0->raiseBodyFlag( NX_BF_KINEMATIC );
		}
	} // for
}
@bitplane: I'm not sure i understand about global and local matrix but i think before backto irrlicht animation if i can convert joint position and rotation in global axis to local axis and set backto IBoneSceneNode i think this problem is solve. If i wrong please notice me.
Thanks for reply.
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Post by wing64 »

Post Reply