Game Development Community

Ragdoll Matrix Help

by Aussiemandias · in Torque 3D Professional · 07/23/2014 (9:30 am) · 3 replies

I'm trying to add a ragdoll into my game. Essentially I get the world matrix of the physics object and then multiply that by my models node rotations so it all lines up. This works pretty good, except for one thing.

It's 2x bigger than it should be.

Does anyone have any idea how to fix this? I've tried scaling the matrix but that just changes the thickness of the model.

In this picture the red skeleton at the bottom is the position of the nodes in world space.

puu.sh/anQgb/97d4d73878.jpg


MatrixF worldMat(true);	//Node matrix in world space
		mShapeInstance->getShape()->getNodeWorldTransform(nodeId,&worldMat);
		MatrixF physMat = mPhysicsRagdoll->getNodeTransform(bone);	//Phyics matrix in world space

		MatrixF finalMat(true);
		finalMat = physMat;
		finalMat.mul(worldMat);

		return finalMat;

I'm pretty stuck at this point, does anyone have any ideas? I find matrixes very confusing.

#1
07/23/2014 (9:36 am)
Have you looked at the updated GMK resource? Maybe something in that could help you.
#2
07/24/2014 (1:40 am)
I had a look at that and it helped me solve an issue I had with specifying joint rotations. Here's the result.


I only have one other question. I have an offset specified as a Point3F that I want to add to the position of the bone (for offsetting the mesh)

This works if the model is upright but if the model falls over then the offset applies wrongly. This is because I'm not rotating the offset with the rigid body as it falls, so an offset of 2.0 on the Z axis will still be on the Z axis when the model is face down.

Anyone know how to fix this? I want to release it to the community once it's done.
#3
07/24/2014 (1:32 pm)
mObjToWorld.mulP(offset)?