1 registered members (TipmyPip),
1,310
guests, and 0
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Fake plane rotation
#382480
09/08/11 16:39
09/08/11 16:39
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I have top down camera (tilt -90) and I want to move camera's position and angles, so it will looks like plane is rotating. I've archived that effect in X cord. by moving camera in X coordinates and changing it's tilt parameters, it looks good. Now I want to make same on the Y coordinates, but ROLL doesn't work to realize that, how can I archive this?
|
|
|
Re: Fake plane rotation
[Re: 3run]
#382560
09/09/11 13:13
09/09/11 13:13
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Here is the example, I've made it in X coordinates and I want to make the same for Y coordinates: Download link I can already move camera at Y coordinates, I just need camera to rotate properly, ROLL doesn't help me.
|
|
|
Re: Fake plane rotation
[Re: 3run]
#382562
09/09/11 13:20
09/09/11 13:20
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
It works, you've just left out the vec_set(...):
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
VECTOR dist;
VECTOR offset;
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
var cam_height = 400;
var cam_roll = 0;
var cam_tilt = 0;
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function set_camera()
{
camera.arc = 80;
// UP and DOWN:
cam_tilt -= 0.5 * mickey.y * time_step;
cam_tilt = clamp(cam_tilt, -110, -70);
// LEFT and RIGHT:
cam_roll += 0.5 * mickey.x * time_step;
cam_roll = clamp(cam_roll, -20, 40);
vec_set(camera.pan,vector(0,cam_tilt,0));
ang_rotate(camera.pan, vector(cam_roll, 0, 0));
vec_set(camera.x,vector(my.x,my.y,my.z + cam_height));
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
action camera_pos()
{
VECTOR temp;
player = my;
set(my, INVISIBLE | PASSABLE);
camera.tilt = -90;
while(1)
{
// DEBUG FPS:
var fps;
fps = (1 / time_frame) * 16;
DEBUG_VAR(fps, 10);
// UP and DOWN:
my.x = -(cam_tilt+90)*10;
// LEFT and RIGHT:
my.y = -cam_roll*10;
set_camera();
wait(1);
}
}
///////////////////////////////////// ///////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function main()
{
fps_max = 60;
video_set(800, 600, 32, 0);
freeze_mode = 1;
level_load("level.wmb");
wait(3);
freeze_mode = 0;
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
I've made some small changes in camera_pos, too.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
|