Originally Posted by
M109uk
I managed to get the oval system via:
[pascal]
var
p,v,u,tmpP: TVertex3f;
begin
p := Player.Position;
tmpP := p;
p[1] := 4;
v := RotatePoint(Player.Position, Player.Rotation);
u := Vertex3f(0,4,0);
gluLookat(p, v, u);
end;
[/pascal]
Of course i know this is wrong..
From what im guessing id say that p should be the position of the camera, v of the target (Actor) and u is the tilt?
Umm, yes, the parameter to gluLookAt are in fact camera position, target position and up vector (that defines the tilt).
Now, the problem is: how do you define the rotation of the player ? With an angle, matrix, quaternion ?
The code above is not correct: the RotatePoint(Player.Position, Player.Rotation) doesn't give you anything useful.
You just get the position of the player rotated of that rotation around the origin, which is not what you want.
What you want is: take a distance vector (as below), rotate it around the player (not the origin) and then add it to
the player position
Something like this:
Code:
begin
Distance := Vertex3f(0, 4, 6);
v := RotatePoint(Distance, Player.Rotation);
v := VectorAdd(Distance, Player.position);
u := Vertex3f(0,1,0);
gluLookat(p, v, u);
end;
Depending on your setup, you could have to rotate by -Player.rotation or subtract instead of add.
Im not too sure on what you mean, i came up with the following and of course it doesnt work lol (im no good at theory :roll
[pascal]
var
p,Distance: Array [0..2] of Single;
begin
Distance := Vertex3f(0, 4, 6);
p := VertexAdd(Player.Position, Distance);
glLookat(p, Player.Position, Vertex3f(0,4,0));
end;
[/pascal]
No, this way you just add the distance and the position, without first orienting the direction (see above).
I know that this things are hard to visualize..
Bookmarks