I need HINTS for first person shooter

I am developing a game like Halo…

I am trying to load a gun model in the bottom of the screen…

I want the gun to move with the player (CharacterControl),

I tried attaching the gun model in the guiNode so that it will move with the player but it did not worked…

I also tried setting its physicslocation the same as the physicslocation of the player, the location of the gun moves with the player but the problem is the rotation…

Please help me guys… I need your suggestions…

attach it to your players node?

or use a camera node

Have you tried searching? There’s multiple threads on that exact subject and many successes. Just saying.

I am planning to attach to the flyCam.

Can I do that?

Sure, but why? If your using the CharacterControl, you’d want to move that and make the cam follow that. And then use a CameraNode to have a spatial (weapon) follow the camera and offset it in front of you.

I’d say start here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3#tutorials_for_beginners.

Once you got that part but still can’t get it to work try googling your questions, make sure to add jME3 to your search.

If you still can’t get it to work after that I’d say read this: mikeash.com: Getting Answers and ask help here. Also don’t forget: Trying things out yourself never hurts! You can only learn from that :slight_smile:

Is there a way to attach the gun model to the flyCam?

I read the tutorials already…

but I was just having a problem in attaching the gun as a first person perspective…

Ok, I’ll just read how to use CameraNode in the manual…

Hey guys, I have read the tutorials about Camera Node.

Can I attach the gun model to that node like rootNode.attachChild(gun);

Example:

cameraNode.attachChild(gun);

@blacksilver said:
Hey guys, I have read the tutorials about Camera Node.
Can I attach the gun model to that node like rootNode.attachChild(gun);
Example:
cameraNode.attachChild(gun);


Did you try it?

Also, this might be helpful: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies

I tried using a camera node but it didnt worked…

I cant see the gun even though Im adding a Directional Light and AmbientLight…

Thanks for your suggestion, but I read it already…

I tried to use the flycam.

I set the gun’s location the same as the CharacterControl…

I set the gun’s location to cam.getRotation()…

finally, it worked…



but, I still got a problem, when I face north, I can see the gun but when I face to the south, I dont see the gun…



I guess the problem was the rotation…

the camera node takes care of all of that for u, so ur doing something wrong. I would suggest using another viewport, that would end up even more torturous.