I’ve got a simple question (hope so) but i just can’t figure it out…

I want to rotate the cam around location x150, y150 & z150
Because of my class “linear algebra” I want to do it by updating a vector with sinus and cosinus.
I used this piece of code with an airplane which had to make corners and it worked perfectly.

But for some reason I can’t get it to work with the cam.

Some ideas?

[java]Vector3f newPos = new Vector3f(1,0,1);

// change coörds according to new angle
newPos = new Vector3f(
newPos.x * cos + newPos.z * -sin,
newPos.y,
newPos.x * sin + newPos.z * cos
);
cam.setLocation(cam.getLocation().add(newPos));
cam.lookAt(new Vector3f(150,150,150), cam.getLocation());[/java]

To me it looks like you are just passing random stuff… I can’t even close to make the second parameter into an up vector and I don’t know enough about your coordinate system to know if the first is sensible at all.

[java]
public pattern()
{
float cos = (float) Math.cos(Math.toRadians(0.0625f));
float sin = (float) Math.sin(Math.toRadians(0.0625f));

airPlane = new AirPlane(startingPosition); // I create my airPlane (its a custom shape) and set it to the default position
// this way i make a 90 degree rotation
if(i <= 180)
corner(0.5f,0.5f);
airPlane.addTranslation(newPos); // i add the new position to the current position of the plane

}

private void corner(float rotX, float rotZ)
{
Vector3f newPos = new Vector3f(rotX,0,rotZ); // axis of rotation

// change coörds according to new angle
newPos = new Vector3f(
newPos.x * cos + newPos.z * -sin,
newPos.y,
newPos.x * sin + newPos.z * cos
);