C_move

Posted By: Ragada

C_move - 08/25/11 15:20

I have this code:
if(key_w) c_move(camera, vector(camera.x,camera.y, camera.z),vector(camera.x+10,camera.y, camera.z),IGNORE_PASSABLE);
and I want to move camera forward for 10. Ist that code right, or how can I correct it? Please help me.
//correct me if I'm wrong
c_move(what, vector_from, vector_to, mode);
Please show me correct code for moving with camera forward.
Posted By: Pappenheimer

Re: C_move - 08/25/11 15:33

This "c_move(what, vector_from, vector_to, mode);" is nonsense - did you have a look into the manual?
You are mixing up two different functions: c_trace is not the same as c_move!
Posted By: swerning

Re: C_move - 08/25/11 15:38

Hi,

the problem is that you can only move entities with c_move, therefore you have two options:

camera.x+=(key_w-key_s)*5*cos(camera.pan); // 5 is the move speed
camera.y+=(key_w-key_s)*5*sin(camera.pan);

This code updates the camera position manually but does not use collision detection, i.e. the camera can move through walls.

The second option would be to create an entity, make it invisible, move and rotate that entity with c_move and c_rotate and put the camera position/angle at its position/angle.
Hope that helps, best

Stefan
© 2024 lite-C Forums