Posted By: pewpew
Moving an object - 01/01/09 08:02
if you have a tank, and you want to move it, is this the proper proceedure? -
1) apply physics to tank
2) move tank using c_move and c_rotate
i cant seem to get it working properly.
EDIT: heres the code i am trying to use - but it just jilts the tank left/right/up/down, then it returns to the original coordinates.
for some reason, only rotation works. and it only does so if i hold down key 46 (which presses the tank against the level)
1) apply physics to tank
2) move tank using c_move and c_rotate
i cant seem to get it working properly.
EDIT: heres the code i am trying to use - but it just jilts the tank left/right/up/down, then it returns to the original coordinates.
Code:
action move_tank()
{
while(1)
{
//forward and reverse
if(key_pressed(17) == 1)
c_move(me, vector(10,0,0), nullvector, IGNORE_PASSABLE);
if(key_pressed(31) == 1)
c_move(me, vector(-10,0,0), nullvector, IGNORE_PASSABLE);
//rotation
if(key_pressed(30) == 1)
c_rotate (me, vector(2,0,0), IGNORE_PASSABLE);
if(key_pressed(32) == 1)
c_rotate (me, vector(-2,0,0), IGNORE_PASSABLE);
//downwards
if(key_pressed(46) == 1)
c_move(me, vector(0, 0, -20 * time_step), nullvector, IGNORE_PASSABLE);
wait(1);
}
}
for some reason, only rotation works. and it only does so if i hold down key 46 (which presses the tank against the level)