|
Moving an object
#243853
01/01/09 08:02
01/01/09 08:02
|
Joined: Oct 2008
Posts: 67
pewpew
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
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.
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)
Last edited by pewpew; 01/01/09 08:52.
HURRR DERP DERP DEERRPP HURR
|
|
|
Re: Moving an object
[Re: Petra]
#243966
01/01/09 23:26
01/01/09 23:26
|
Joined: Oct 2008
Posts: 67
pewpew
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
yeah it was actually workshop 18 and 19 i was using to teach myself. i still cant seem to get it to work?
so you say DONT use c_move if u are using physics??
HURRR DERP DERP DEERRPP HURR
|
|
|
Re: Moving an object
[Re: heinekenbottle]
#244005
01/02/09 05:01
01/02/09 05:01
|
Joined: Oct 2008
Posts: 67
pewpew
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
nope.. still doesnt work. ive been stuck on this for literally 2 months. its so annoying and frustrating and i mean, its such a simple concept but i cant seem to find the correct solution!!!! should i upload the project?
HURRR DERP DERP DEERRPP HURR
|
|
|
Re: Moving an object
[Re: Cowabanga]
#244015
01/02/09 07:23
01/02/09 07:23
|
Joined: Oct 2008
Posts: 67
pewpew
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
just the free version. i'm guessing there could be a conflict with commands that are restricted to the paid versions??
HURRR DERP DERP DEERRPP HURR
|
|
|
Re: Moving an object
[Re: Michael_Schwarz]
#244137
01/02/09 22:16
01/02/09 22:16
|
Joined: Jan 2009
Posts: 86 Brasil - RS
DiegoFloor
Junior Member
|
Junior Member
Joined: Jan 2009
Posts: 86
Brasil - RS
|
I'm just beginning to learn too, so I may be wrong. But I think that when you're using physics you need to work with forces to move things around. I don't know how's your model, but depending on it you could apply a torque in the wheels or a simple force, pointing forward, in the gravity center of the whole object. [edit: actually, I don't think it matters if the force is in the gc] [edit2: actually, I don't think you can choose where to apply the force on an object! ]
Last edited by DiegoFloor; 01/02/09 22:29.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|