incorrect camera-movement

Posted By: V_Sola

incorrect camera-movement - 02/08/09 19:07

hi guys,

it's me again. I want my camera to be constantly behind my model but i don't manage to fix up an correct c_move-function.

Can anyone help me?

that's my code:

////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>


////////////////////////////////////////////////////////////////////

ENTITY* wizard;

////////////////////////////////////////////////////////////////////


}
function main()
{
//video_mode = 7; // 800x600 pixels
video_switch (8,32,1);
level_load ("Drohne_Level_1.wmb");


}

action wizard_with_pointer()
{
wizard = my;
my.ambient = 100;
while(1)
{
VECTOR speed;

my.pan += -50 * mouse_force.x * time_step;

speed.x += 5 * (key_a - key_d) * time_step;
speed.y += 5 * (key_s - key_w) * time_step;

c_move (my,speed,nullvector,IGNORE_PASSABLE | GLIDE);

camera.x = my.x;
camera.y = my.y - 150;
camera.z = my.z + 25;

camera.pan = my.pan + 270;
camera.tilt = - 12;

my.red = 100;
wait(1);
}
}

action wizard_simple()
{
my.ambient = 100;
}
Posted By: Crypton

Re: incorrect camera-movement - 02/08/09 19:18

Maybe this will clear out something:
(play with the values and change player for my)
vec_set(camera.x,player.x);
camera.z += 63;
camera.x -= 100*cos(player.pan);
camera.y -= 100*sin(player.pan);
camera.pan = player.pan;

Cheers!
Posted By: V_Sola

Re: incorrect camera-movement - 02/08/09 19:57

now it looks like this:

action wizard_with_pointer()
{
wizard = my;
my = player;
player.ambient = 100;
while(1)
{
//VECTOR speed;

player.pan += -50 * mouse_force.x * time_step;

player.x += -5 * (key_a - key_d) * time_step;
player.y += -5 * (key_s - key_w) * time_step;

c_move (my,nullvector,nullvector,IGNORE_PASSABLE | GLIDE);

vec_set(camera.x,player.x);

camera.x -= 100*cos(player.pan);
camera.y -= 100*sin(player.pan) - 150;
camera.z += player.z + 25;

camera.pan = player.pan;
camera.tilt = - 12;


wait(1);
}
}

but the camera still moves wrong and the engine doesn't find the pointed model.
Wheres my mistake?
Posted By: Quad

Re: incorrect camera-movement - 02/08/09 20:03

my = player;

would be

player = me;
Posted By: Crypton

Re: incorrect camera-movement - 02/08/09 20:21

also it would have been easier (as I mentioned before) to just change player to my. player is built-in pointer. As you have already wizard pointer created, you don't have to attach this action to player pointer anymore.
If you choose to use player then replace wizard with player. But I guess you use wizard pointer somewhere else, so this wouldn't be a good idea!

Cheers!
Posted By: nsksleeper

Re: incorrect camera-movement - 02/12/09 09:05

@V-Sola: hi, i think i had the same problem. do you see the model(the wizard) from the side? if so, go to med and rotate the model in the upper left window that it faces to the right. Maybe that helps
Posted By: Mageron

Re: incorrect camera-movement - 02/12/09 09:17

I created an own view called Sicht and some new variables:
VAR sicht_dist[3] = -20,0,20; //The dist form the view to the player
VAR sicht_ang[3];

Add this in your Action:

vec_diff(temp,nullvector,sicht_dist);
vec_to_angle(sicht_ang,temp);
vec_set(Sicht.x,sicht_dist);
vec_rotate(Sicht.x,my.pan);
vec_add(Sicht.x,my.x);
vec_set(Sicht.pan,sicht_ang);
ang_add(Sicht.pan,my.pan);

I hope I could help you.
© 2024 lite-C Forums