Is it possible to move the skeletons using Collada DOM.

Hi,

Could anyone please give me an example about how to change the position of a node(skeleton) and display(animate) it. I think I am on the right track about using LocalToWorldMatrix but no matter how I mess the matrix ,there is no change happens at all.

It drives me crazy. Could anyone who had similar experience help me.Here are my code:

CrtNode *_SceneRoot = CrtNew(CrtNode);
		CrtNode * joint = CrtNew(CrtNode);
		CrtNode * children = CrtNew(CrtNode);

		_SceneRoot=_CrtRender.GetSceneRoot();
		CrtPrint(" Number of Children of scene root is:  %d 
", _SceneRoot->GetNumChildren()); 
		joint = _SceneRoot;
		//CrtPrint(" Next node of scene root is:  %s 
", joint->GetId()); 
		
			//joint = joint ->GetNext();
			//CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetChild();		
			CrtPrint(" Getting Children ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
		
			joint = joint->GetChild();		
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();	
			joint = joint->GetNext();
			joint = joint->GetNext();
			//CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			int n = 5;
			while(joint && n>0)
			{
					joint = joint->GetChild();
					n--;
			}

			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
				CrtPrint(" Used for skining:  %s 
", joint->GetIsUsedForSkinning ());
				CrtMatrix * m = joint->GetLocalToWorldMatrix();
				CrtMatrix4x4RotateAngleAxis((float *)m ,0.0,0.0,1.0,190.0);
				CrtMatrixTranspose((float *)m,(float *)m);
				//joint->SetLocalToWorldMatrix(m);
				CrtMatrix * m2 = joint->GetLocalToWorldMatrix();
				CrtVec4f tran((float)2.4,(float)3.6,(float)4.8,(float)10.2);
				CrtMatrix4x4Translate((float *)m2,tran);
				/*joint->SetUpdateLocalToWorldMatrix(true);
				joint->SetUpdateLocalMatrix (true);
				joint->Update(0.1);
				joint->Render();*/

			joint = _SceneRoot;
		//CrtPrint(" Next node of scene root is:  %s 
", joint->GetId()); 
		
			//joint = joint ->GetNext();
			//CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetChild();		
			CrtPrint(" Getting Children ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
		
			joint = joint->GetChild();		
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 	
			joint = joint->GetNext();
			joint = joint->GetNext();
			CrtPrint(" Getting joint ID is:  %s 
", joint->GetId()); 
			joint->SetLocalToWorldMatrix(m2);
			joint->SetUpdateLocalToWorldMatrix(true);
			joint->SetUpdateLocalMatrix (true);
			//joint->Update(0.1);
			joint->Render();
			//_CrtRender.SetAnimationPaused( CrtTrue );

I know they seems to be crazy and aim less, but I just want to make the scene become different. Is there any method like glutPostRedisplay that I need to use. I think it is not necessary because the animation which is loaded is rendered again and again.
Really appreciate any help from you guys.

Cheers,
Ray

I suspect that the sample viewer’s animation calculations are stomping on your manual changes of the joint transforms. You’ll want to do apply your transforms after the animations (check what Update() is doing and before the Render().

Thanks a lot for the reply.
That is really something. I found that _CrtRender.Render(); contains the update for the whole scene. So it seems to be designed to render the animation from the collada file rather than getting any information outside. Do you think it is possible to use it the way I am trying. Would you please give me some examples about how to change the way in which it render the scenes.Otherwise, I think I have to go to the animation part and try to add some animation which I think would be very complicated.

Anyway, thanks again for you help , I am kinda desperate.

I MADE IT!!!THANKS!