GLB bone rotation

Hi

I have GLB model loaded with skeletal mesh. Now the skeleton bone I cant rotate or move. I need to pick up its parent and rotate them.

Now when I pick up bone in inspector with a gizmo I can rotate 90 degrees in one direction. and X y z in rotation is changed in only 1 direction.

Now when i use rotate() method i can only add amount of angles to rotate by. So its good for animation in onBeginAnimation.
Now the question:

How can I rotate a bone from 0 to 90deg in its local axis and animate just 1 value from 0 to 90 (Math.PI / 2) and set it to a value somehow?

So I can always set it to 0 and it will coma back.

I have terrible results with rotationQuaterion. I cant make it work with code.

But gizmo in inspector works no problems and there are input fields to set to 0 and it goes to 0 to 90 its moved to 90. Cant work this out at all.

I just want to be able to set bone rotation in Angle value like 0 90 75 and back from them. Not with adding missing part but with a value

Have you tried using Bone.setRotationQuaternion():

bone.setRotationQuaternion(rotation, BABYLON.Space.LOCAL);

// or

bone.setRotationQuaternion(rotation, BABYLON.Space.WORLD);

Hi @regna

But when you load GLB files your bones do nothing. You need to get their parent TransformNode and then this method is not available.

TypeError: boneTransfNode.setRotationQuaternion is not a function

What to do with it in GLB loaded models that’s the question?

Ah, I’m not too familiar with glTF bones. It looks like you’re right that you have to use the Transform Node according to the glTF Skinning Documentation.

Can you show an image/video of how setting the Transform Node’s rotation gives an unexpected result (preferably while the skeleton is in a T-pose)?

1 Like

@regna

Not realy cant show models but any model will do.

Just the rotate method works that adds increments of rotation. There is no method that sets A value that relates to local position.

I do not know why it works in .babylon file model but not glTF

Can you find some other way to rotate transformNode?

I work with .babylon instead of glTF, so maybe that’s why I haven’t seen this issue. There may be a special way to rotate glTF bones that our glTF expert @bghgary could help us with :slight_smile:

Hi @bghgary

Do you have any suggestions on this topic? I actually saw some of your tickets that you help with but I could not find a solution. Also, all the Docs have examples with .babylon file as well.

Would be nice to have a solution to this issue.

Regards
Peter

This is difficult to help without a playground or something so I can look at what you are doing. Can you provide some code / assets (ideally a playground) to look at so I can more easily help?

Hi @bghgary

Sorry for late replay just found a bug in Babylon that I was investigating for you for some time :slight_smile: Opened ticket today :slight_smile:

So here is a PG:

And the problem is I need to get Bone Transform node to rotate the bone.

But I can only use rotate function that takes increments of rotation.

i would like to use GSAP with the animations and I need to have a angle value and animate it like that:

Animation 1:
Form 0 to 30 deg.

Animation 2:
From 30 to 60.

Cancel Animation:
Rotation back to 0 so it will animate from any angle to 0.

and it needs to be back to 0 so initial position.

When I use increments I cant use GSAP that takes a value from X to Y and animates value in between.

Method setRotate looks promising but it does not exist on TransformNode.

So how I can ratate that bone in its local coordinates system like the gizmo does?

When I grab the gizmo of that bone and only pull by red circle its doing what I want but then It uses Quaterion that is animating 4 values and that mess up the animation. Already tried that.

I think you are asking how to manipulate a node transform and it has nothing to do with bones.

Here is what I think you trying to do: https://playground.babylonjs.com/#BUJL56#3

Basically, the Arm has an existing rest rotation and set absolute angles relative to the rest rotation. That’s what I did in the playground. Is this what you’re looking for?

1 Like

HI.

I made the initial test but it works. Thanks for the solution :slight_smile: If I will have more questions about it I will coma back to you on this thread.

Regards
Peter

1 Like