2 registered members (TipmyPip, 1 invisible),
18,731
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Move camera in the pan direction
[Re: PadMalcom]
#389607
12/16/11 09:34
12/16/11 09:34
|
mercuryus
Unregistered
|
mercuryus
Unregistered
|
haha
move the camera with w/s or an entity?
|
|
|
Re: Move camera in the pan direction
[Re: ]
#389608
12/16/11 09:42
12/16/11 09:42
|
Joined: Mar 2006
Posts: 1,993 Karlsruhe
PadMalcom
OP
Serious User
|
OP
Serious User
Joined: Mar 2006
Posts: 1,993
Karlsruhe
|
Camera Edit: Ah, and I want to avoid using c_move. A sin / cos approach would be nice 
Last edited by PadMalcom; 12/16/11 09:44.
|
|
|
Re: Move camera in the pan direction
[Re: PadMalcom]
#389610
12/16/11 09:55
12/16/11 09:55
|
mercuryus
Unregistered
|
mercuryus
Unregistered
|
//rotate
vec_set(camera.pan, vector((camera.pan+(key_a-key_d)*time_frame*5)%360, 0,0));
// move
vec_set(camera.x, vector(camera.x+(key_w-key_s)*cosv(camera.pan)*time_frame*5, camera.y+(key_w-key_s)*sinv(camera.pan)*time_frame*5, 0));
|
|
|
Re: Move camera in the pan direction
[Re: PadMalcom]
#389613
12/16/11 10:54
12/16/11 10:54
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
Hi, you can also achieve it without trigronometry
VECTOR vtemp;
...
vec_set ( vtemp, vector ( kwy_w - key_s, key_d - key_a, 0 );
vec_rotate ( vtemp, camera.pan );
vec_normalize ( vtemp, Speed * time_step );
vec_add ( camera.x, vtemp );
Salud!
|
|
|
Re: Move camera in the pan direction
[Re: txesmi]
#389803
12/18/11 18:19
12/18/11 18:19
|
Joined: Mar 2006
Posts: 1,993 Karlsruhe
PadMalcom
OP
Serious User
|
OP
Serious User
Joined: Mar 2006
Posts: 1,993
Karlsruhe
|
Hehe no prob! @mercuryus: How would I add straving in there? EDIT: Figured it out:
// move
vNewPosition = vector(
camera.x+(key_w-key_s)*cosv(camera.pan)*time_step*WALK_SPEED +(key_a-key_d)*cosv(camera.pan+90)*time_step*WALK_SPEED,
camera.y+(key_w-key_s)*sinv(camera.pan)*time_step*WALK_SPEED +(key_a-key_d)*sinv(camera.pan+90)*time_step*WALK_SPEED,
0
);
vec_set(camera.x, vNewPosition);
Last edited by PadMalcom; 12/18/11 18:39.
|
|
|
|