Jump to content

Simple Inverse Kinematics


photo

Recommended Posts

Posted (edited)

Hello everyone,

Unigine 2.19.1 here.
I've read the documentation but from what I can gather, we need to make some specific code in order to use IK for our characters ?

I have this pretty usual configuration:

image.thumb.png.11821d4be167a38256745f4af89a2201.png

My character has an idle and a walk animation (it's skinned mesh).

How could I attach the luggage to him so as to have his hand on the luggage while the rest of his body (apart from the elbow) is animated ?
In the editor.

Or do I have to code something ? A world expression could work ?

Thanks in advance

Edited by K.Wagrez
Posted

Hi Kevin,

I don't think that WorldExpression would be enough, though.

There is currently no UI for the animations and IK. You can check C++ samples with animations (https://github.com/unigine-engine/cpp-api-samples/tree/main/source/animation) and develop your own solution and UI (maybe even Editor Plugin) for that.

Luggage object itself should follow the character in some way. When the character is standing still, the bag should remain close by. When the character starts moving, the bag should tilt and move along the ground plane behind them. This behavior is handled by a separate logic system.

After that, we want to create the impression that the character is pulling the bag with their hand. For this, we simply use IK to attach the character’s palm to a specified target point on the bag’s handle.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Okay well, I went with some C++ components included in my plugin. 

My IK is working fine, however I'm trying to find the methods that would allow me to manually control bone rotations for the fingers:
image.png.b5f8c63357b35e5d1625b038dd04b9b1.png

I've tried using setLayerBoneRotation on every finger bone, this way:

 

// fingers
skinned->setLayer(0, true, 1.0f);
for (int i=0; i<fingers.size(); i++)
{
  int bone_id = skinned->findBone(fingers[i]);
  if (bone_id != -1)
  {
    skinned->setLayerBoneFrameUses(0, bone_id, ObjectMeshSkinned::ANIM_FRAME_USES_NONE);
    skinned->setLayerBoneRotation(0, bone_id, Unigine::Math::quat(0.5,0.0,0.0,0.5));

    m_finger_bone_ids.push_back(bone_id);
  }
  else
    Unigine::Log::warning("Could not find bone");
}

But the fingers keep on using the animation data to move and no offset is visible. I see no other methods that seem to do what I'm looking to do.

I just want to block the animation from affecting the fingers, and control their rotation myself.

By the way I checked, those are the correct bones.

Posted

Hi Kevin,

Could you please check if you have enabled layer masks on this animation layer via setLayerFrameUsesEnabled?

If enabling masks does not change the behavior, we would need to review a small test sample using your content, as the issue may be related either to the content itself or to the code.

Thank you!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...