Jump to content

Bone scaling and translating in the world


photo

Recommended Posts

Posted

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!

Posted

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.

Posted

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.

Posted

Please, upload the test scene which demonstrates the problem.

Posted

Hi extaliones

 

 

Here is the scene:

 

bone_scaling.rar

 

 

There are two sliders, first one the scale Bip01, second one to scale Bip01 L Thigh.

Bone transform and mesh position are logged to console.

Posted

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.

Posted

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
×
×
  • Create New...