Bind node to bone with manual run animation


photo

Recommended Posts

Hi,

i have skinned mesh into which run animation via functions setFrame, lerpLayer and finally result of animations set to mesh via copyLayer(-1, layer).

I add node to bind offset to bone on the start of init:

			int boneId = 64;
			Unigine::NodeDummyPtr dm = Unigine::NodeDummy::create();
			dm.get()->setParent(mesh);
			dm.get()->setPosition(UNIGINE_VEC3(1, 0, 0));
			mesh.get()->setBindNode(boneId, dm);
			mesh.get()->setBindBoneSpace(boneId, Unigine::ObjectMeshSkinned::BONE_SPACE_OBJECT);
			mesh.get()->setBindMode(boneId, Unigine::ObjectMeshSkinned::BIND_MODE_ADDITIVE);
			mesh.get()->setBindNodeSpace(boneId, Unigine::ObjectMeshSkinned::NODE_SPACE_LOCAL);

The offset to bone is applied, but the mesh is in T position.

It something missing to set for working it?

I trying it in 2.13 alfa.

 

Thanks

Honya

Link to post

Hello,

This behavior is due to a function call copyLayer(-1, layer) with index -1 as the destination layer. In this case, the transforms of the mesh instance will be used instead of the layer transforms, and the internal mesh update will not be called. In this case, I would recommend using the zero layer as the resulting one. The attached example shows a simple use of node binding to bone.

AppWorldLogic.cpp AppWorldLogic.h

Link to post

Hi,

thanks for point to copy to 0 layer final animation so it's now playing animation with modify bones.

 

It's nice feature, but sadly it have worse performance  28 ku 31 fps for 50 skinned meshs with 158 bones that have modificated around 80 bones then do it via code each frame.

Honya

Link to post