50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.jme3.math.Quaternion
|
|
* com.jme3.math.Vector3f
|
|
* com.jme3.renderer.Camera
|
|
* com.jme3.scene.CameraNode
|
|
* com.jme3.scene.Node
|
|
* com.jme3.scene.Spatial
|
|
* com.jme3.scene.control.CameraControl
|
|
*/
|
|
package wpq.tests;
|
|
|
|
import com.jme3.math.Quaternion;
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.renderer.Camera;
|
|
import com.jme3.scene.CameraNode;
|
|
import com.jme3.scene.Node;
|
|
import com.jme3.scene.Spatial;
|
|
import com.jme3.scene.control.CameraControl;
|
|
|
|
public class PlayerCam
|
|
extends CameraNode {
|
|
private Node player;
|
|
private Quaternion CAM_ROTATION;
|
|
public static Vector3f CAM_VECTOR = new Vector3f(0.0f, 25.0f, -15.0f);
|
|
|
|
public void setPlayer(Node player) {
|
|
this.player = player;
|
|
}
|
|
|
|
public Node getPlayer() {
|
|
return this.player;
|
|
}
|
|
|
|
public PlayerCam(Node player, String name, Camera camera) {
|
|
super(name, new CameraControl(camera));
|
|
this.player = player;
|
|
this.CAM_ROTATION = new Quaternion();
|
|
this.CAM_ROTATION.fromAngleAxis(0.7853982f, Vector3f.UNIT_X);
|
|
}
|
|
|
|
public void setupCamera() {
|
|
this.player.attachChild((Spatial)this);
|
|
this.setLocalTranslation(CAM_VECTOR);
|
|
this.lookAt(this.player.getLocalTranslation(), Vector3f.UNIT_Y);
|
|
}
|
|
}
|