[LibGDX] Gun 3D model to be in front of the player

Hey guys,

I been having this problem that I want to give a 3d model the same position and rotation as the player, kinda like having the origin of the gun on the player’s position and “look” to where the player is looking.
So for this I have the player translation and the camera direction.

gun.instance.transform.set(playertranslation.x, playertranslation.y, playertranslation.z, camera.direction.x, camera.direction.y, camera.direction.z, 0);

Note that “instance” is the ModelInstance and “playertranslation” is just a Vector3 with the player’s position.

Anyone of you guys figured this out? There seems to be something with Quaternions and Matrix transformations, but it’s much harder than I though and can’t seem to find a way of doing it, specially since I don’t understand them that much.

Cheers.