Heya guys, I need a third person camera for my game.
One which follows a specific object around the place!
In jME2 there was a ChaseCamera class, however I cannot find this in jME3.
Can anybody please point me towards a jME3 version of a third person cam?
Thanks very much in advance,
Andy.
We have attempted to make one , but it doesnt quite work as when we move our object the camera kinda lags behind it.
package org.snow.cameras;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Geometry;
public class ThirdPersonCam {
Geometry player;
Camera cam;
public ThirdPersonCam(Camera cam, Geometry player) {
this.cam = cam;
this.player = player;
}
public void updateCam() {
Vector3f direction = player.getLocalRotation().getRotationColumn(2);
// Vector3f direction2 = player.getLocalRotation().getRotationColumn(1);
// float yDirection = direction2.y; // Might need this in future
float xDirection = direction.x;
float zDirection = direction.z;
Vector3f camLocation = new Vector3f(player.getWorldTranslation().x
+ (xDirection * 10), player.getWorldTranslation().y + 4f,
player.getWorldTranslation().z + (zDirection * 10));
cam.setLocation(camLocation);
cam.lookAt(player.getWorldTranslation(), Vector3f.UNIT_Y);
}
}