manuel.gysin Posted October 17, 2010 Posted October 17, 2010 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!
ulf.schroeter Posted October 17, 2010 Posted October 17, 2010 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.
manuel.gysin Posted October 17, 2010 Author Posted October 17, 2010 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.
Guest extaliones Posted October 18, 2010 Posted October 18, 2010 Please, upload the test scene which demonstrates the problem.
manuel.gysin Posted October 18, 2010 Author Posted October 18, 2010 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.
manuel.gysin Posted October 19, 2010 Author Posted October 19, 2010 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.
Guest extaliones Posted October 20, 2010 Posted October 20, 2010 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). 1
Recommended Posts