Hai!
I got a car game.
And the camera is attached to a node.
this node is attached to the car so u can see it from behind and it follows.
But, when the car flips, so does the camera, so when I flip all I see is the black side of the ground!
I'v tried to fix this is all possible ways possible!
Using ChaseCamera doesnt do anything better!
All equations ends up in being useless!
Heres my moste recent attempt (attempt no. 432):
public void updateCam(Camera cam){
float y = 0;
float value = 50;
//y = camNode.getWorldTranslation().y -(Car.getWorldTranslation().y +10);
System.out.println("
");
System.out.println("camNode: "+camNode.getWorldTranslation().toString());
System.out.println("Car: "+Car.getWorldTranslation().toString());
System.out.println("OldVec: "+oldVec.toString());
if (Car.getWorldTranslation().toString().equals("(0.0, 0.0, 0.0)")){
camNode.getLocalTranslation().set(oldVec);
} else {
if (camNode.getWorldTranslation().y < (Car.getWorldTranslation().y+value)){
float numb = -camNode.getWorldTranslation().y;
float CarY = Car.getWorldTranslation().y + numb + value;
System.out.println("numb: "+numb+" CarY: "+CarY);
y = CarY-numb;
} else {
float numb = -(Car.getWorldTranslation().y + value);
float camY = camNode.getWorldTranslation().y + numb;
System.out.println("numb: "+numb+" camY: "+camY);
y = camY- numb;
}
Vector3f extraVec = Car.getLocalRotation().getRotationColumn(0).mult(30);
extraVec.y = 0;
camNode.getLocalTranslation().set(extraVec.x,y,extraVec.z);
oldVec = camNode.getLocalTranslation();
System.out.println("Result: "+y);
}
//camNode.lookAt(CarFront.getLocalTranslation(), new Vector3f(0,1,0));
cam.lookAt(CarFront.getLocalTranslation(), new Vector3f(0,0,0));
}
I'm desperate for help! I cant fix this!
All I want is so the camera is looking at the cam from behind, No mather if it flips over!
How?!