|
0 registered members (),
631
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
cameras and mouse movement
#129256
05/10/07 15:57
05/10/07 15:57
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
hi i need a bit of an idea on what kind of camera function would use just the cursor, i tried an fps camera but that view also moves my mesh, i need the mesh to stay still but the camera to be able to move around, so i can click on crewmen to give orders. which kind of camera should i use for this? thanks in advance for all advice.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: cameras and mouse movement
[Re: jigalypuff]
#129257
05/10/07 16:10
05/10/07 16:10
|
Joined: Oct 2003
Posts: 702
zazang
User
|
User
Joined: Oct 2003
Posts: 702
|
maybe a 3rd person view would give a good view of crewmen,but the mesh may move..so you have to add a little code to avoid player mesh movement when cursor is visible.
I like good 'views' because they have no 'strings' attached..
|
|
|
Re: cameras and mouse movement
[Re: zazang]
#129258
05/10/07 16:14
05/10/07 16:14
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
thanks i`ll look through the aums to see if there`s an example of this sort of thing.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: cameras and mouse movement
[Re: jigalypuff]
#129259
05/10/07 16:32
05/10/07 16:32
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
?? sry, maybe I'm just ... kinda slow right now... but what do you mean the mesh moves? when your cam moves, then the cam moves, when the mesh moves, the mesh moves, but the cam doesn't move the mesh...!? or do you mean that the camera needs to be able to rotate without the mesh rotating as well, and your fps is connected to it? if yes, try this code (3rd person cam, that rotates around the player... without the player turning is this what you need?) Code:
var cam_rotation[3];
function third_person_cam() { var cam_vec[3]; while(1) { vec_set(cam_vec,vector(-1000,0,10); cam_rotation.pan = ang(cam_rotation.pan + mouse_force.x*time_step*5); vec_set(temp,cam_rotation); vec_add(temp,player.pan); vec_rotate(cam_vec,temp); vec_add(cam_vec,player.x); vec_set(camera.x,cam_vec); vec_diff(temp,player.x,camera.x); vec_to_angle(camera.pan,temp); wait(1); } }
action player_action { third_person_cam(); ... ]
not tested, hope it works
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: cameras and mouse movement
[Re: Germanunkol]
#129260
05/10/07 16:42
05/10/07 16:42
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
let me try to explain again, i know i`m a bit of a dunce at getting across what i mean  basicly i want the model to stay still and for the mouse to control the camera. here`s the basic idea i have this mesh  when i press 2 the camera switchs from isometric view to fps view which is this  i need the bridge to not be affected by the camera movement, eventually i`ll add crewmen and they will respond to orders which will pop up when you click on them. so i want the mouse to pan the camera so i can click on the crew. hope thats a better explanation. and thanks.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: cameras and mouse movement
[Re: jigalypuff]
#129261
05/10/07 17:00
05/10/07 17:00
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
Quote:
i tried an fps camera but that view also moves my mesh
Just change the code so it does not move your mesh 
|
|
|
Re: cameras and mouse movement
[Re: Claus_N]
#129262
05/10/07 17:37
05/10/07 17:37
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
a good idea claus, but i`m jiggered if i can see what i have to change lol. i`ll post the camera code and hope you`ll show me whats wrong. Code:
if (camera_number == 2) { camera.x = player.x -40; camera.y = player.y - 0; camera.z = player.z + 0; camera.pan = player.pan; camera.tilt = 0; }
thats the first person cam code, and thanks again for the help.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: cameras and mouse movement
[Re: Claus_N]
#129264
05/10/07 18:09
05/10/07 18:09
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
heck, i think i see the problem, the code which turns the camera is the same as the code which turns the ship in isometric mode, does this mean i need to change everything? Code:
function c_ship { player = my; my.scale_x = 2.0; my.scale_y = my.scale_x; my.scale_z = my.scale_x; var ship_speed; while (1) { if (key_w == on) { if (ship_speed.x < 1) { ship_speed.x += 1.3 * time; } } else { if (ship_speed.x >= 0) { ship_speed.x -= 0.05 * time; } } if (ship_speed.x < 0) {ship_speed.x = 0;} if (key_a == on) { my.pan += 3 * time; my.roll - = 3 * time; } if (key_d == on) { my.pan -= 3 * time; my.roll + = 3 * time; } if (ship_speed.z < 0) {ship_speed.z = 0;} if (key_q == on) { my.tilt + = 3 * time; } if (ship_speed.z < 0) {ship_speed.z = 0;} if (key_e == on) { my.tilt - = 3 * time; } ent_move (ship_speed.x, nullvector); ship_camera(); wait (1); } }
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: cameras and mouse movement
[Re: jigalypuff]
#129265
05/10/07 18:16
05/10/07 18:16
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
Well, you do need some changes  I did this very fast, so it might need something Code:
function c_ship { player = my; my.scale_x = 2.0; my.scale_y = my.scale_x; my.scale_z = my.scale_x; var ship_speed; while (1) { if(camera_number != 2) { if (key_w == on) { if (ship_speed.x < 1) { ship_speed.x += 1.3 * time; } } else { if (ship_speed.x >= 0) { ship_speed.x -= 0.05 * time; } } if (ship_speed.x < 0) {ship_speed.x = 0;} if (key_a == on) { my.pan += 3 * time; my.roll - = 3 * time; } if (key_d == on) { my.pan -= 3 * time; my.roll + = 3 * time; } if (ship_speed.z < 0) {ship_speed.z = 0;} if (key_q == on) { my.tilt + = 3 * time; } if (ship_speed.z < 0) {ship_speed.z = 0;} if (key_e == on) { my.tilt - = 3 * time; } ent_move (ship_speed.x, nullvector); ship_camera(); wait (1); } else { // FPS camera code here if(key_a) { camera.pan += 3 * time; } if(key_d) { camera.pan -= 3 * time; } } } }
EDIT: Remember to delete/comment out the camera.pan = player.pan; line! 
Last edited by Claus_N; 05/10/07 18:17.
|
|
|
|