[SOLVED] Attach Lemur Labels To Joints

Hello Guys,
I’m trying to attach Lemur labels to joints / bones . Well not really attach but just place a label with the joint name near the joint.
Problem is that the labels are spread horizontally instead of vertically (I will add a video demonstrating it soon)
Here is the code:

    private void showHideJoints(AppModel model, final boolean showJoints) {
        String retval = model.getJointsList();
        if(retval!=null && retval.length()>0) {
            String joints[] = retval.split(",");
            for(int i=0;i<joints.length;++i) {
                String jointName = joints[i];
                Vector3f pos = model.getJointPosition(jointName);
                Label l = new Label(jointName);

                l.setFontSize(0.5f);
                l.setPreferredSize(new Vector3f(20f,1f,0));
                l.setLocalTranslation(pos);
                model.model.attachChild(l);

            }
        }
    }

And here is the helper method for getting the joint position:

 public Vector3f getJointPosition(String jointName) {

        if(this.resource.isJ3O()) {

            Skeleton sk = findSkeleton(model);
            if(sk!=null) {

                Bone b = sk.getBone(jointName);
                if(b!=null) {
                    return b.getLocalPosition();
                }
            }

        } else {

            Spatial sp = model.getChild(0);
            SkinningControl skinningControl = sp.getControl(SkinningControl.class);
            if(skinningControl!=null) {
                Joint j = skinningControl.getArmature().getJoint(jointName);
                if(j!=null) {
                    return j.getLocalTranslation();
                }
            }

        }

        return null;

    }

Here is the video:


What do you think?
Thanks!

Try to attach labels to joint attachment node

1 Like

I’m working both with Joints & Bones (when loading J3O files)
what is the equivalent of attachment nodes in Bones?

2 Likes

Thanks a lot! checking…

Working great. I would like however to try putting billboard labels instead of “regular” ones. Do you happen to know if Lemur support billboard mode labels?

Add a billboard control… should work like any other spatial.

2 Likes
2 Likes

Fantastic support guys! Thank you so much.
Everything now works as expected and I can easily teach my students about using joints in 3D games.

5 Likes

Glad it is solved.

By the way, there is another one here, created by nehon, which also does bone picking, I guess.

3 Likes

Oh that is cool. I can see that being useful for debugging in almost any large game application too.

Yes. And now I can also fine - tune the collision detection between animated models