Is there a way move dynamically a bone from skeletal animation?
I can get a bone with this code:
this.skel = ct.res.makeSkeleton('AnimationName'); var boneIKTarget = this.skel.armature.getBone('BoneName'); console.log(boneIKTarget);
But how to change its position? I tried these lines in On Step of a room but no change appears.
boneIKTarget.boneData.transform.x = ct.mouse.x ; boneIKTarget.boneData.transform.y = ct.mouse.y ;
Is there a method to transform it?
Thank you for your reply.
I found a way to display the new position but I'm always looking for the way to have a precise value. The bone moves but not really at the mouse position.
// we have to add this line to update the new position boneIKTarget.invalidUpdate();
We can too change the offset of the bone to modify its position.
boneIKTarget.offset.x = ct.mouse.x - mainIK.boneData.transform.x ; boneIKTarget.offset.y = ct.mouse.y - mainIK.boneData.transform.y - ct.height ; boneIKTarget.invalidUpdate();
If someone could help.