Get my Node in the foreground!

I created a CameraNode with a weapon.

Now the weapon shall be in the foreground, even if I go through a box or any other object.

It would look strange if the weapon disappear inside the wall (and the crosshair too).



So the Node need to be in the foreground!



Thanks


I think it is pretty common to draw the weapon in a different pass, after rendering the scene, and after clearing de Z-Buffer.

Also is quite common to modify the far and near planes, so you can correctly draw your weapon which is very close.

I believe the crosshair, unless a 3D crosshair, should be drawn in ortho mode along with your hub.

It's a 3D cross^^



Also I would like to have the weapon together with the rest(important, but difficult to explain)

So what can I do?

You can keep together or wherever you want… but you still can render it in a separate pass.


// Put everything together:

Node scene = ...
Node weapon = ...

// Temporary dettach weapon and prepare camara and render the scene, but disable the weapon
scene.dettachChild(weapon);
yourPrepareCameraForScene();
DisplaySystem.getDisplaySystem().getRenderer().draw(scene);

// Reattach weapon, prepare the camera again and render
scene.attachChild(weapon);
yourPrepareCameraForWeapon();
DisplaySystem.getDisplaySystem().getRenderer().draw(weapon);



I think there's no problem with keeping the weapon within the scene. Actually I have tried something similar and it worked.

It's a tricky solution, but I can live with this

Thanks!!!