|
0 registered members (),
631
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
model won`t move
#128643
05/08/07 15:53
05/08/07 15:53
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
hi i wanted a few camera views for my ship, i found some great code in the aums and added it to my script, however now my ship won`t go forward, but it will pan and tilt. any thoughts on this, code below and thanks for any help. action c_ship { player = my; my.scale_x = 2.0;//scale it down to have it's size my.scale_y = my.scale_x;//same as scale x my.scale_z = my.scale_x;//same as scale x var ship_speed; var player_dist; 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); } }
function ship_camera() { if (key_1 == on) {camera_number = 1;} if (key_2 == on) {camera_number = 2;} if (key_3 == on) {camera_number = 3;} if (camera_number == 1) // top view { camera.x = player.x; camera.y = player.y; camera.z = player.z + 900; // play with this value camera.pan = player.pan; camera.tilt = -90; } if (camera_number == 2) // simulated first person view (that's just another isometric view, really) { camera.x = player.x - 20 * cos(player.pan); camera.y = player.y - 20 * sin(player.pan); camera.z = player.z + 18; camera.pan = player.pan; camera.tilt = 0; } if (camera_number == 3) // true isometric view { camera.x = player.x - 200 * cos(player.pan); // 200 = distance camera.y = player.y - 200 * sin(player.pan); // same value here camera.z = player.z + 150; // above the player camera.pan = player.pan; camera.tilt = -27; // look down at the player } wait (1); }
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: model won`t move
[Re: jigalypuff]
#128644
05/08/07 16:10
05/08/07 16:10
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
First of all, please use the "code" tag, it makes the code much easier to read =)
It looks like ship_speed is just a variable (not a vector/array), so you shouldn't use "ship_speed.x", but just "ship_speed". Or you should make it a vector.
EDIT: What AUM number?
Last edited by Claus_N; 05/08/07 16:11.
|
|
|
Re: model won`t move
[Re: Claus_N]
#128645
05/08/07 16:20
05/08/07 16:20
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
first of all what "code" tag ? lol the camera code is from aum 34, it is the car ai camera code. the ship moves ok with the code until i added the camera code. can you give me an example on how it should work as a vector? like an aum perhaps. thanks.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: model won`t move
[Re: jigalypuff]
#128646
05/08/07 16:46
05/08/07 16:46
|
Joined: Oct 2005
Posts: 196
ambe
Member
|
Member
Joined: Oct 2005
Posts: 196
|
dude .. the code works fine -- i tryed it out ..
- code monkey
|
|
|
Re: model won`t move
[Re: ambe]
#128647
05/08/07 16:55
05/08/07 16:55
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
no ambe it does not, when i press w my ship does not move forward, it will pan and tilt but not move forward the camera code works ok mind, just i can`t move forward.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: model won`t move
[Re: jigalypuff]
#128648
05/08/07 17:17
05/08/07 17:17
|
Joined: Oct 2005
Posts: 196
ambe
Member
|
Member
Joined: Oct 2005
Posts: 196
|
thats wierd ... i checked it out, it moves and eveything .. all i did was adding a main script and the "camera_number" var.
Last edited by ambe; 05/08/07 17:18.
- code monkey
|
|
|
Re: model won`t move
[Re: ambe]
#128649
05/08/07 17:29
05/08/07 17:29
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
what like this? and thanks for the help Code:
function main() { level_load("darkfrontiers.wmb"); mouse_map = hempire_pcx; var camera_number = 2; mouse_mode = 1; while (1) { mouse_pos.x = pointer.x; mouse_pos.y = pointer.y; wait (5); } }
tried that but it never wrked lol. quick edit on a typo.
Last edited by jigalypuff; 05/08/07 17:33.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: model won`t move
[Re: jigalypuff]
#128650
05/08/07 17:53
05/08/07 17:53
|
Joined: Oct 2005
Posts: 196
ambe
Member
|
Member
Joined: Oct 2005
Posts: 196
|
well .. i had that camera_number on the out side .. and i had them in diffrent scripts. include <cship.wdl>; .. works fine ..
- code monkey
|
|
|
Re: model won`t move
[Re: ambe]
#128651
05/08/07 18:07
05/08/07 18:07
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
let me get this right then, you put the camera script and the player script as seperates, so the player action is cship.wdl and the rest is in the main script?
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: model won`t move
[Re: jigalypuff]
#128652
05/08/07 18:41
05/08/07 18:41
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
i`ve tried a load of different combos with this ambe, none of them work for me at all, would you please post the script as you have it so i can see what you have done? thanks.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
|