First Person Look with Weapon

how can i create First Person Look with Model?

i attached it to the CameraNode…

but the Model is above the Camera and not near the Camera…??

any help?

Spec : JME 1.0

TDMaster said:

but the Model is above the Camera and not near the Camera..??

Well, move it then.
The model will have it's origin (point 0,0,0) at the camera position, which is not necessarily the center of the model, or even anywhere near the model's visible geometry.

This is some code of me:


import game.bin.loader.Mesh;

import com.jme.bounding.BoundingSphere;
import com.jme.input.NodeHandler;
import com.jme.math.Vector3f;
import com.jme.scene.CameraNode;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.system.DisplaySystem;

public class FirstPersonCam extends Node{

   private CameraNode camFirstPerson;
   public FirstPersonCam(){
      DisplaySystem display = DisplaySystem.getDisplaySystem();
      camFirstPerson = new CameraNode( "First Person", display.getRenderer().getCamera());
        //input = new NodeHandler( camFirstPerson, 15f, 1 );

        Mesh gun = new Mesh("game/data/mesh/weapon/glock_17.3ds");
      gun.setLocalTranslation(new Vector3f(-5,-4,10));
      camFirstPerson.setLocalTranslation(new Vector3f(0,0,-75));

This should do the trick

yes thank i didnt know that when u attach something to Node the LocalTranslation change local to the Model… and not the world…

thanx for the examples and repsonding… :smiley:

You are welcome