/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kodemat.visu.appstates;

import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.renderer.Camera;
import kodemat.visudata.VisuHelper;
import kodemat.visudata.VisuType;
import kodemat.visudata.VisuVector3f;
import kodemat.visudata.visuComponents.VisuComponent;

/**
 *
 * @author Institute fml (TU Munich) and Institute FLW (TU Dortmund)
 */
public class CameraDisplayAppstate extends AbstractAppState  {
    VisuHelper helper;
    private Camera cam;
    private final String userId;
    private VisuComponent cameraNode;



    public CameraDisplayAppstate(VisuHelper helper,String userID) {
        this.helper = helper;
        userId =userID;
    }
    

    @Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
    
        createCamera(userId);
        
      cam = app.getCamera();
                
    }

    
    
    @Override
    public void update(float tpf) {
        VisuVector3f camPos = new VisuVector3f(cam.getLocation().x,cam.getLocation().y,cam.getLocation().z);
//       helper.getComponent("camera").setTranslation(camPos);
    }

    private void createCamera(String userId) {

     cameraNode = helper.createComponent("camera_"+ userId);
            cameraNode.setType(new VisuType(VisuType.MODEL, "CeMAT_Assets/Pallete/palette.j3o"));
            cameraNode.setTranslation(new VisuVector3f(0f,0f,0f));
    }

    
    
}

@@ -767,16 +767,81 @@
 aNode;%0D%0A
+    private float timeCount  = 0l;%0D%0A    private float time =1f;%0D%0A
 %0D%0A%0D%0A%0D%0A  
@@ -963,16 +963,41 @@
 serID;%0D%0A
+  createCamera(userId);%0D%0A
     %7D%0D%0A 
@@ -1151,49 +1151,8 @@
   %0D%0A
-        createCamera(userId);%0D%0A        %0D%0A
     
@@ -1192,19 +1192,18 @@
         
- 
 %0D%0A
+
     %7D%0D%0A%0D
@@ -1266,24 +1266,83 @@
  tpf) %7B%0D%0A   
+%0D%0A     timeCount =timeCount+ tpf;%0D%0A%0D%0Aif(timeCount%3E=time)%7B%0D%0A
      VisuVec
@@ -1472,17 +1472,26 @@
 (%22camera
-%22
+_%22+ userId
 ).setTra
@@ -1505,24 +1505,117 @@
 n(camPos);%0D%0A
+      System.out.println(%22Camera pos x %22+camPos.x+%22y %22+camPos.y);%0D%0A       timeCount= 0f;%0D%0A%7D%0D%0A
     %7D%0D%0A%0D%0A   

create cameradisplayappstate