Placing model in front of flycam


I need urgent help on how to place a model or part of a model in front of a flycam, like the hand and gun in the action games.

Very detailed help and code would be better.

Thank you very much


Vector3f position = cam.getWorldCoordinates(inputManager.getCursorPosition(), 0.3f);


if i good know this code tells us world coordinates of place where is mouse in distance 0.3f from camera.

So you could try use:


Vector3f position = cam.getWorldCoordinates(new Vector2f(0,0), 1.5f);


but maybe there is better way to do it

Thanks for the help, but I’m new at this can you please explain more how to use this position to set the player in front of cam.

Because as you can see from my simpleUpdate code that the cam is following the player’s location not the other way around, so how can I set the player to stay in front of cam ?

thanks again


public void simpleUpdate(float tpf) {

Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);

Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);

walkDirection.set(0, 0, 0);

if (left) { walkDirection.addLocal(camLeft); }

if (right) { walkDirection.addLocal(camLeft.negate()); }

if (up) { walkDirection.addLocal(camDir); }

if (down) { walkDirection.addLocal(camDir.negate()); }




Hi Mr. normen thanks for your help, but the article is not there anymore, do you have something else about what I want because I’m kinda frustraded for that manner. Thanks again

What article? I posted a search url. This question has been asked like 10.000 times already.