Camera Following an Object [ Resolved ]

Hello all, first thanks to read this topic. I create this topic owing to that i have a problem with my camera. I’ve want a camera wich recopy the movement of an object. But i can’t find something like .move(Vector3f) or setLocalTranslation(Vector3f) for the camera and that’s why my camera do something wrong.



See for yourself :



[java]package mygame;



import com.jme3.input.KeyInput;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.material.TechniqueDef.ShadowMode;

import com.jme3.math.ColorRGBA;

import com.jme3.math.FastMath;

import com.jme3.math.Vector2f;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Box;

import de.jarnbjo.vorbis.Floor;



public class game extends SimpleApplication



{



protected Spatial ninja;

private Material floor_mat;

protected Vector3f worldupVector = new Vector3f (0,1,0);

protected float currentdActor = 0;

protected final float dActor = 50;

protected float angleB = 0;

Vector3f camLoc = new Vector3f(dActor,0,0);

Vector3f ninLoc;

Vector3f camDir;

Vector3f vCam = new Vector3f(10,10,10);

TextDisplay myText;

protected Vector3f v = new Vector3f(0,0,0);

protected boolean canTranslate = false;



@Override

public void simpleInitApp()



{

speed = (float) 0.05;

ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.rotate(0.0f, 0.0f, 0.0f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);

rootNode.attachChild(ninja);

initKeys();



Box box = new Box(new Vector3f(0,-4,-5), 15,.2f,15);

Geometry floor = new Geometry(“the Floor”, box);

Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat1.setColor(“m_Color”, ColorRGBA.Gray);

floor.setMaterial(mat1);

rootNode.attachChild(floor);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



myText = new TextDisplay(guiFont, assetManager, guiNode);

myText.debugText();



}



private void initKeys() {



inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_Z));

inputManager.addMapping(“Back”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_D));



inputManager.addListener(analogListener, new String[]{“Forward”, “Back”, “Left”, “Right”});



}



private AnalogListener analogListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {



if (name.equals(“Forward”)) {

v.zero();

v = ninja.getLocalTranslation();

v.addLocal(0, 0, -1speed);

ninja.setLocalTranslation(v);

canTranslate = true;





}

else if (name.equals(“Back”)) {

v = ninja.getLocalTranslation();

v.addLocal(0, 0, 1
speed);

ninja.setLocalTranslation(v);





}



else if (name.equals(“Left”)) {

v = ninja.getLocalTranslation();

v.addLocal(-1speed, 0, 0);

ninja.setLocalTranslation(v);



}



else if (name.equals(“Right”)) {

v = ninja.getLocalTranslation();

v.addLocal(1
speed, 0, 0);

ninja.setLocalTranslation(v);



}

}



};



@Override

public void simpleUpdate(float tpf) {



cam.lookAt(ninja.getLocalTranslation(), worldupVector);



myText.setText(cam.getLocation().toString()+ninja.getLocalTranslation());

if (canTranslate)

{



cam.setLocation(cam.getLocation().add(v));



}



canTranslate = false;



}[/java]



My camera doesn’t recopy the local Translation of my ninja. In case you have a solution please tell me there.

Thanks to read this Topic, Bye.

You can use CameraNode to move the camera like a Spatial. You can also use ChaseCamera to follow an object. The camera always has world coordinates so its got only setLocation and setRotation.

Ok thanks. However, i still have a problem. My cam doesn’t want to move.

[java]

package mygame;



import com.jme3.input.KeyInput;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.material.TechniqueDef.ShadowMode;

import com.jme3.math.ColorRGBA;

import com.jme3.math.FastMath;

import com.jme3.math.Vector2f;

import com.jme3.math.Vector3f;

import com.jme3.scene.CameraNode;

import com.jme3.scene.Geometry;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.scene.control.CameraControl;

import com.jme3.scene.shape.Box;

import de.jarnbjo.vorbis.Floor;



public class game extends SimpleApplication



{



protected Spatial ninja;

private Material floor_mat;

protected Vector3f worldupVector = new Vector3f (0,1,0);

protected float currentdActor = 0;

protected final float dActor = 50;

protected float angleB = 0;

Vector3f camLoc = new Vector3f(dActor,0,0);

Vector3f ninLoc;

Vector3f camDir;

Vector3f vCam = new Vector3f(10,10,10);

TextDisplay myText;

protected Vector3f v = new Vector3f(0,0,0);

protected boolean canTranslate = false;

CameraNode nCam;



@Override

public void simpleInitApp()



{

speed = (float) 0.05;

ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.rotate(0.0f, 0.0f, 0.0f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);

rootNode.attachChild(ninja);

nCam = new CameraNode(cam);

rootNode.attachChild(nCam);



initKeys();



Box box = new Box(new Vector3f(0,-4,-5), 15,.2f,15);

Geometry floor = new Geometry(“the Floor”, box);

Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat1.setColor(“m_Color”, ColorRGBA.Gray);

floor.setMaterial(mat1);

rootNode.attachChild(floor);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



myText = new TextDisplay(guiFont, assetManager, guiNode);

myText.debugText();



}



private void initKeys() {



inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_Z));

inputManager.addMapping(“Back”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_D));



inputManager.addListener(analogListener, new String[]{“Forward”, “Back”, “Left”, “Right”});



}



private AnalogListener analogListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {



if (name.equals(“Forward”)) {



v = ninja.getLocalTranslation();

v.addLocal(0, 0, -1speed);

ninja.setLocalTranslation(v);

nCam.setLocalTranslation(v);



}

else if (name.equals(“Back”)) {

v = ninja.getLocalTranslation();

v.addLocal(0, 0, 1
speed);

ninja.setLocalTranslation(v);





}



else if (name.equals(“Left”)) {

v = ninja.getLocalTranslation();

v.addLocal(-1speed, 0, 0);

ninja.setLocalTranslation(v);



}



else if (name.equals(“Right”)) {

v = ninja.getLocalTranslation();

v.addLocal(1
speed, 0, 0);

ninja.setLocalTranslation(v);



}

}



};



@Override

public void simpleUpdate(float tpf) {





}[/java]



Mmmm in fact i think that my node is not really attach to there camera. :frowning:

You attached the camera node but you’re not doing anything with it?

To make it follow exactly the movement of an object, attach it to that object.

Since you’re moving the ninja in your AnalogListener then you would probably want to attach the CameraNode to the ninja and not the root node.

Ok now i know what it’s wrong ^^. But when i attach the CameraNode to the ninja i can’t do something although normally the cam just following the ninja and copy what i’ve done on him.

[java]

package mygame;



import com.jme3.input.KeyInput;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.material.TechniqueDef.ShadowMode;

import com.jme3.math.ColorRGBA;

import com.jme3.math.FastMath;

import com.jme3.math.Vector2f;

import com.jme3.math.Vector3f;

import com.jme3.scene.CameraNode;

import com.jme3.scene.Geometry;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.scene.control.CameraControl;

import com.jme3.scene.shape.Box;

import de.jarnbjo.vorbis.Floor;



public class game extends paramGame



{



protected Spatial ninja;

private Material floor_mat;

protected Vector3f worldupVector = new Vector3f (0,1,0);

protected float currentdActor = 0;

protected final float dActor = 50;

protected float angleB = 0;

Vector3f camLoc = new Vector3f(dActor,0,0);

Vector3f ninLoc;

Vector3f camDir;

Vector3f vCam = new Vector3f(10,10,10);

TextDisplay myText;

protected Vector3f v = new Vector3f(0,0,0);

protected boolean canTranslate = false;

CameraNode nCam;



@Override

public void simpleInitApp()



{

speed = (float) 0.05;

ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.rotate(0.0f, 0.0f, 0.0f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);

rootNode.attachChild(ninja);

nCam = new CameraNode(cam);

nCam.attachChild(ninja);



initKeys();



Box box = new Box(new Vector3f(0,-4,-5), 15,.2f,15);

Geometry floor = new Geometry(“the Floor”, box);

Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat1.setColor(“m_Color”, ColorRGBA.Gray);

floor.setMaterial(mat1);

rootNode.attachChild(floor);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



myText = new TextDisplay(guiFont, assetManager, guiNode);

myText.debugText();



}



private void initKeys() {



inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_Z));

inputManager.addMapping(“Back”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_D));



inputManager.addListener(analogListener, new String[]{“Forward”, “Back”, “Left”, “Right”});



}



private AnalogListener analogListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {



if (name.equals(“Forward”)) {



v = ninja.getLocalTranslation();

v.addLocal(0, 0, -1speed);

ninja.setLocalTranslation(v);



}

else if (name.equals(“Back”)) {

v = ninja.getLocalTranslation();

v.addLocal(0, 0, 1
speed);

ninja.setLocalTranslation(v);





}



else if (name.equals(“Left”)) {

v = ninja.getLocalTranslation();

v.addLocal(-1speed, 0, 0);

ninja.setLocalTranslation(v);



}



else if (name.equals(“Right”)) {

v = ninja.getLocalTranslation();

v.addLocal(1
speed, 0, 0);

ninja.setLocalTranslation(v);



}

}



};



@Override

public void simpleUpdate(float tpf) {





}[/java]

I just find a Package untilted CameraControl if someone know how this library can be used tell me.

CameraControl is used to synchronize the position between the cameraNode and the camera. It’s used internally with a CameraNode, you don’t have to use it directly in your case.



The issue in your code is that you attach the ninja to the camNode, you have to do it the other way around : attach the camNode to the ninja.



You have to understand that children node copy parent’s movement, scale and rotation, but not the other way around.

Mmmm, therefore the ninja has a method untilted “attachchild” ? Though when i search in the ninja methods i can find anything like this.



what i’ve done :



[java]nCam.attachChild(ninja);[/java]



Your solutions :



[java]ninja.attachChild(nCam);[/java]



It’s what u want to do ?

Declare the ninja as a Node not as a Spatial and you should find the method.

1 Like

ohh man thanks :slight_smile: .







It’s the schema that i imagine but when i program this the ninja doesn’t want to move. It’s not possible i’m going crazy :frowning:

[java]@Override

public void simpleInitApp()



{

ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.rotate(0.0f, 0.0f, 0.0f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);













ninjaNode = new Node(“Ninja_Node”);



nCam = new CameraNode(cam);

ninjaNode.attachChild(nCam);

ninjaNode.attachChild(ninja);

rootNode.attachChild(ninja);

rootNode.attachChild(ninjaNode);



initKeys();



Box box = new Box(new Vector3f(0,-4,-5), 15,.2f,15);

Geometry floor = new Geometry(“the Floor”, box);

Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat1.setColor(“m_Color”, ColorRGBA.Gray);

floor.setMaterial(mat1);

rootNode.attachChild(floor);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



myText = new TextDisplay(guiFont, assetManager, guiNode);

myText.debugText();



}



private void initKeys() {



inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_Z));

inputManager.addMapping(“Back”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_D));



inputManager.addListener(analogListener, new String[]{“Forward”, “Back”, “Left”, “Right”});



}



private AnalogListener analogListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {



if (name.equals(“Forward”)) {



v.zero();

v.addLocal(0, 0, -1speed);

ninjaNode.move(v);



}

else if (name.equals(“Back”)) {

v.zero();

v.addLocal(0, 0, 1
speed);

ninja.move(v);





}



else if (name.equals(“Left”)) {

v.zero();

v.addLocal(-1speed, 0, 0);

ninja.move(v);



}



else if (name.equals(“Right”)) {

v.zero();

v.addLocal(1
speed, 0, 0);

ninja.move(v);



}

}



};



@Override

public void simpleUpdate(float tpf) {



cam.lookAt(ninja.getLocalTranslation(), worldupVector);

myText.setText(cam.getLocation().toString());



}[/java]

You don’t have to create a ninja and a ninjaNode, just ninja as a Node

Ho i see what’s wrong, you have to set the direction of the Camera control from Node to cam.

like this



Node ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.rotate(0.0f, 0.0f, 0.0f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);



nCam = new CameraNode(cam);

nCam .setControlDir(ControlDirection.SpatialToCamera);

ninja.attachChild(nCam);

rootNode.attachChild(ninja);



then you move the ninja.



This should work

2 Likes

Oh guys you are really good :stuck_out_tongue: ! It’s ok now my camera move like an object and recopy what the node is doing :D. But i have still a problem ^^. I would implement a distance between my Camera and my Node. I’ll think about it but if you have a solution I would be interested :wink: .

Consider getting your vector math knowledge up shape when using jME will save you a lot of trouble and enable you to do a lot of stuff.

[java]Vector3f pointA, pointB;

Vector3f vectorAtoB=pointB.subtract(pointA);

float distanceAtoB=vectorAtoB.length();[/java]

thank you for the help !



Now i copying the chaseCamera class and i trying to adapt what he done. But when i read her program it’s totally incomprehensible and i would like to know what he done that. Where I stumble is in the public computePosition.

[java]

package mygame;



import com.jme3.input.KeyInput;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.material.TechniqueDef.ShadowMode;

import com.jme3.math.ColorRGBA;

import com.jme3.math.FastMath;

import com.jme3.math.Quaternion;

import com.jme3.math.Vector2f;

import com.jme3.math.Vector3f;

import com.jme3.scene.CameraNode;

import com.jme3.scene.Geometry;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.scene.control.CameraControl.ControlDirection;

import com.jme3.scene.shape.Box;

import de.jarnbjo.vorbis.Floor;



public class gameTest extends paramGame



{



protected Node ninjaNode = new Node(“ninja_node”);

protected Vector3f worldupVector = new Vector3f (0,1,0);

Vector3f vCam = new Vector3f(10,10,10);

TextDisplay myText;

Spatial ninja;

Vector3f pos = new Vector3f(0,0,0);

private float vRotation = FastMath.PI / 6;

private float rotation = 0;

private float distance = 20;



@Override

public void simpleInitApp()



{

speed = 0.5f;

ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.rotate(0.0f, 0.0f, 0.0f);

ninja.setLocalTranslation(10f, -5.0f, -2.0f);

rootNode.attachChild(ninja);





initKeys();



Box box = new Box(new Vector3f(0,-4,-5), 15,.2f,15);

Geometry floor = new Geometry(“the Floor”, box);

Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat1.setColor(“m_Color”, ColorRGBA.Gray);

floor.setMaterial(mat1);

rootNode.attachChild(floor);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



myText = new TextDisplay(guiFont, assetManager, guiNode);

myText.debugText();



}



private void initKeys() {



inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_Z));

inputManager.addMapping(“Back”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_D));



inputManager.addListener(analogListener, new String[]{“Forward”, “Back”, “Left”, “Right”});



}



private AnalogListener analogListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {



if (name.equals(“Forward”)) {



ninja.move(0,0,-0.1fspeed);



}

else if (name.equals(“Back”)) {



ninja.move(0,0,0.1f
speed);



}



else if (name.equals(“Left”)) {

ninja.move(-0.1fspeed,0,0);



}



else if (name.equals(“Right”)) {



ninja.move(0.1f
speed,0,0);



}

}



};



@Override

public void simpleUpdate(float tpf) {



cam.lookAt(ninja.getLocalTranslation(), worldupVector);

computePosition();

cam.setLocation(pos);



}



private void computePosition() {





float hDistance = (distance) * FastMath.sin((FastMath.PI / 2) - vRotation);

pos = new Vector3f(hDistance * FastMath.cos(rotation), (distance) * FastMath.sin(vRotation), hDistance * FastMath.sin(rotation));

pos = pos.add(ninja.getWorldTranslation());





}

[/java]

I agree, what this guy or girl or whatever, did is totally incomprehensible.



However I may be able to give you some hints if you tell me what you are trying to adapt exactly.

So, i’ve want that my camera follows my object with a distance between him and her that we modify. Besides, my camera repsect the next schema :







when i move my objet on one side the after some time she start to move around him and change the direction of the object until the camera is behind the object. If you want more detail about what i imagine tell me ^^.

ok look at the TestChaseCamera and tell me what you think.



It use the smooth motion of the chase camera (chaseCamera.setSmoothMotion(true)), and has a “trailing” behavior (the camera smoothly goes in the target’s trail while it moves)

1 Like

Huuu my cam following my object but, whereas i set trailing(true) my cam doesn’t go behind my target. What’s wrong ? When i look inside ChaseCamera it remains a mystery as to its construction.

[java]

package mygame;



import com.jme3.input.ChaseCamera;

import com.jme3.input.KeyInput;

import com.jme3.input.controls.AnalogListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Box;



public class game extends paramGame



{



private Material floor_mat;

TextDisplay myText;

Spatial ninja;

ChaseCamera myCam;



@Override

public void simpleInitApp()



{



speed = 0.1f;

ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);

rootNode.attachChild(ninja);



myCam = new ChaseCamera(cam, ninja,inputManager);

myCam.setTrailingEnabled(true);

myCam.setEnabled(true);



initKeys();



Box box = new Box(new Vector3f(0,-4,-5), 15,.2f,15);

Geometry floor = new Geometry(“the Floor”, box);

Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat1.setColor(“m_Color”, ColorRGBA.Gray);

floor.setMaterial(mat1);

rootNode.attachChild(floor);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

rootNode.addLight(sun);



myText = new TextDisplay(guiFont, assetManager, guiNode);

myText.debugText();



}



private void initKeys() {



inputManager.addMapping(“Forward”, new KeyTrigger(KeyInput.KEY_Z));

inputManager.addMapping(“Back”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_Q));

inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_D));



inputManager.addListener(analogListener, new String[]{“Forward”, “Back”, “Left”, “Right”});



}



private AnalogListener analogListener = new AnalogListener() {

public void onAnalog(String name, float value, float tpf) {



if (name.equals(“Forward”)) {



ninja.move(0, 0, -1speed);



}

else if (name.equals(“Back”)) {



ninja.move(0, 0, 1
speed);



}



else if (name.equals(“Left”)) {



ninja.move(1speed, 0, 0);



}



else if (name.equals(“Right”)) {



ninja.move(-1
speed, 0, 0);



}

}



};



}





[/java]

Trailing only works with smooth motion, so use setSmoothMotion(true).



I really need to write a proper doc about the cam usage.



About the mysterious construction of the chase cam…what to say…

It has 3 parameters the distance the the target, the horizontal rotation and the vertical rotation around the target.

each time the mouse is dragged or the target is moved i compute actual values for this 3 parameters, and just linearly interpolate to the values they SHOULD have.



This gives a smooth motion and a slight speed ramp effect to the camera movement.

For trailing I do exactly the same thing but i compute the horizontal rotation so that the camera goes right behind the target.

See what’s new in my game !



My camera rotate around my object and follow is movement.



http://www.megaupload.com/?d=KWFSJYVO (Download -jar)