Jump to content

Bone scaling and translating in the world


photo

Recommended Posts

Hello

 

 

Maybe it's only a simply problem but I can't find a solution since days:

 

 

Situation:

I load an ObjectMeshSkinned (Human character) and scale a bone.

The feet of the object are on the ground.

 

character.setFrameBoneTransform(character.findBone("Bip01"), initialTransformValues[_boneType] + scale(0, 0, newValue));

 

This works fine and the whole ObjectMeshSkinned is scaled.

 

 

Problem:

The feet are going through the ground cause of the scaling.

This is a logical behavior I know. But I can't find any way to correct the z-position of the ObjectMeshSkinned.

 

 

For and hints I'm very thankful!

Link to comment

This works fine and the whole ObjectMeshSkinned is scaled.

 

 

I don't think scaling the whole character via bone matrix is a valid/good approach. Maybe you should try using Node::setScale( vec3 ) instead and use ObjectMeshSkinned bounding box dimensions/center for z-coordinate correction.

Link to comment

I don't think scaling the whole character via bone matrix is a valid approach. Maybe you should try using Node::setScale( vec3 ) instead.

 

The above example is not the best one.

We are planing the scale some other bones too, and so Node::setScale( vec3 ) is not an option for us.

The same problem will occur if I scale the legs bones, the feet are going through the ground.

Link to comment

I think I found something:

 

Changed back to getWorldBoneTransform().

I see a change in *.m22 after scaling a bone:

 

float initM22;
initM22 = initialTransformValues[_switch].m22;

float newM22;
newM22 = mat4(character.getWorldBoneTransform(character.findBone("Bip01"))).m22;

float zCorrection;
zCorrection = (newM22 - initM22) * 100;

character.setPosition(vec3(-95.559, 7.339, 0.1 * cc + 0.1));

 

This code only works when scaling up at the moment.

Link to comment

Intersection of scinned mesh with terrain calculates manually in every update function(please, see the code sample "BodyRagDoll inverse kinematics" ragdoll_09.cpp or ragdoll_08.cpp in samples/physics).

  • Like 1
Link to comment
×
×
  • Create New...