I
I
Ilya2d2017-10-28 13:05:34
3D
Ilya2d, 2017-10-28 13:05:34

How to "move" a bone in libGDX?

Has anyone encountered the need to move limbs without using animation?
For example, I have a joystick. When I rotate it, the character's hand should also rotate. You can't do animation here, because. I don't know which way I will turn the joystick in a second. I solved the problem through a crutch, made an animation with one parameter for each bone (in the g3dj file) and, when necessary, I replace the coordinates in the necessary bones. The result is an animation with 1 frame that is constantly changing, but I have a question, how to solve this problem correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya2d, 2017-10-29
@Ilya2d

Figured something out. modelInstance.getNode("Bone") returns a bone node.
modelInstance.getNode("Bone").getChild(0).getChild(0).getChild(0).getChild(0) returns the right leg bone node for my skeleton. (this node has id 2, as in the blender and according to the skeleton tree, this is the leg)
Now the question is what actions can be done with the node at all?
It has properties:
JavaHighlight Code

Matrix4 globalTransform
String  id
boolean inheritTransform
boolean isAnimated
Matrix4 localTransform
Array<NodePart> parts 
Quaternion rotation
Vector3 scale
Vector3 translation

I tried to make translation add, nothing happened, scale changed - nothing. Tell me what I'm doing wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question