Help me about first person game

i make game as first person game and i want to draw some object such as Data, Hand of player that should be

appear on the same place every scene. how can i set it move on my camera at the same place (now they don't follow my camera).

and i extend it from "SimpleGame".



(sorry if u can't understand my ENG - -")



Thanks very much

How about using a CameraNode for your camera? Then you could attach it to your player model where the eyes should be.



Or, you can just synchronize the hands position and rotation with the cameras, or the other way around :slight_smile:



Hope that helps!

i extends class from SimpleGame and i can't find the CameraNode. i only find a "Protected Camera cam" in SimpleGame.

i don't know how to attach object on camera.



if possible, please give me an example code for attach object on camera. Thanks… (i'm newbie)

There's a test for it somewhere… IIRC the syntax is something like:


CameraNode cameraNode = new CameraNode(DisplaySystem().getDisplaySystem().getRenderer().getCamera());
rootNode.attachChild(cameraNode);



But you should really take a look at the test!

when i add these 2 command in my code, it effect my object disappear.  then i can't see anything except frame per sec that is from

SimpleGame.



but i noticed that frame per sec in "fpsNode" is on the same location of camera that  i want. and i try to attach my object on

"fpsNode" but my object doesn't show on the same location as "fps". it still like when i attach on rootNode.



Thx for your help. but now i can't do it.

for shorter Question.



Can i attach object on "fpsNode"?

and if it can, how to attach it?



i want to render my player model (first person shooting) on the same location of my screen.



but if there is the better way to do it, please tell me.



thx very much

You shouldn't try to add objects that should be part of the 3D world to fpsNode. This is because fpsNode is used for 2D objects that shouldn't be affected by the camera, e.g. the fps text.



What I meant was for you to add the CameraNode to your player node in some way, which you then add to the rootNode or some other node attached to it.

Perhaps you might spend some more time going through the Tutorials (like Mojo's excellent flag rush series.)  This will give you a better grip on jME fundamentals.