Original Post
can you explain more please
because i was talking about
:
how do you make the displacement?
how do you jump???????
you
on vk_ donw
case
up:....................
left:................
..............
and more...............; if you can please i''m gonna show you what i do for my camera movment:
unit camera;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, MMSystem,
OpenGL, GLut,gl,glu,collision1;
type
Tcamera = class
position:Tvector;
velocity:Tvector;
view:Tvector;
upvector:Tvector;
rayon:glfloat;
constructor Create;
procedure positioncamera(posx:glfloat;posy:glfloat;posz:glfloat;viewx:glfloat;
viewy:glfloat;viewz:glfloat;upx:glfloat;upy:glfloat;upz:glfloat);
procedure mov(speed:glfloat);
procedure rotate(dir:glfloat);
procedure rotatearound(joueur:Tvector;dir:glfloat);
end;
implementation
constructor Tcamera.Create;
begin
inherited Create;
with position do
begin
x:=0;
y:=0;
z:=0;
end;
with view do
begin
x:=0;
y:=1.0;
z:=0.5;
end;
with upvector do
begin
x:=0;
y:=1;
z:=0;
end;
rayon:=0.0;
end;
procedure Tcamera.positioncamera(posx:glfloat;posy:glfloat;posz:glfloat;viewx:glfloat;
viewy:glfloat;viewz:glfloat;upx:glfloat;upy:glfloat;upz:glfloat);
begin
with position do
begin
x:=posx;
y:=posy;
z:=posz;
end;
with view do
begin
x:=viewx;
y:=viewy;
z:=viewz;
end;
with upvector do
begin
x:=upx;
y:=upy;
z:=upz;
end;
end;
procedure Tcamera.mov(speed:glfloat);
var
aux:tvector;
begin
// on obtient d''abord le vecteur indiquant la direction
// en laquelle nous regardons
with aux do
begin
x:=view.x-position.x;
y:=view.y-position.y;
z:=view.z-position.z;
end;
position.x:=position.x+aux.x*speed;
position.z:=position.z+aux.z*speed;
view.x:=view.x+aux.x*speed;
view.z:=view.z+aux.z*speed;
end;
procedure Tcamera.rotate(dir:glfloat);
var
aux:Tvector;
begin
with aux do
begin
x:=view.x-position.x;
y:=view.y-position.y;
z:=view.z-position.z;
end;
view.z:=(position.z+sin(dir)*aux.x+cos(dir)*aux.z);
view.x:=(position.x+cos(dir)*aux.x-sin(dir)*aux.z);
end;
procedure Tcamera.rotatearound(joueur:Tvector;dir:glfloat);
var
aux:Tvector;
begin
with aux do
begin
x:=position.x-joueur.x;
y:=position.y-joueur.y;
z:=position.z-joueur.z;
end;
position.z:=(joueur.z+sin(dir)*aux.x+cos(dir)*aux.z);
position.x:=(joueur.x+cos(dir)*aux.x-sin(dir)*aux.z);
end;
the things is that i don''t hav any velocity vector or acceleration in my class as you can see so can you complete me or arrange this to implemente all thiss with velocity or what you want................
end.
love and peace