Issues with my method


I’m having issues with a 2d texture shown above a models head. At the moment it dose this:

It laggs behind when my model moves, this is the current code im using:

BitmapFont font = _game.getAssetManager().loadFont("Interface/Fonts/Default.fnt");
modelName = new BitmapText(font, false);
modelName.setText("Ogre Dude");
modelName.setBox(new Rectangle(-0.7f, 0f, 1.6f, 0.16f));
modelName.addControl(new BillboardControl());
Vector3f vec = getModel().getLocalTranslation().clone();
vec.y += 5;

// And inside a control update() method:
Vector3f vec = getModel().getLocalTranslation();
Vector3f vec2 = modelName.getLocalTranslation();
vec2.y += 3;

Any advice on a better method of doing this?


try using getWorldTranslation

thanks for the fast reply normen, but its still doing the same thing…

Then you probably move the ogre after you move the text.

I’m using a CharacterControl for the model and setting the walk direction as you did in TestCharacterWalking class. So im guessing the physics control moves the model later… is it so?

Since I don’t know when you call that code I cannot tell you. If its in a Control that you attach to the spatial like it should be then it will be called after the CharacterControl moved it :stuck_out_tongue:

Solved the issue, i was adding the control that was moving the model into root node instead of the model >.>

Now its working just fine, thanks for the help and the lesson!