Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/06/26 07:18
zorro with ccxt?
by opm. 03/03/26 03:17
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 5,487 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
adding local linear force rotates the entity.? #208034
05/24/08 10:14
05/24/08 10:14
Joined: Jul 2007
Posts: 24
N
noobie86 Offline OP
Newbie
noobie86  Offline OP
Newbie
N

Joined: Jul 2007
Posts: 24
hi i'm just starting a car project using GS physics.. here's the first 2 lines of code and its already going crazy smile

////code start
action car_move()

{
//all the standard settings
phent_settype(my,PH_RIGID,PH_BOX);
phent_setmass(my, 30, PH_BOX);
phent_setfriction(my, 15);
phent_setdamping ( my, 10, 20 );

ph_setgravity( earthgravity );

phent_enable(my, 1 );

while(1)
{
camera.x = my.x-200*cos(my.pan); camera.y = my.y-200*sin(my.pan); camera.z = my.z+50;
camera.pan = my.pan;

my_pos[0]=my.x; my_pos[1]=my.y; my_pos[2]=my.z;

//heres the force vector for_force which gives a force along the car's local X-axis
if(key_cuu){for_force[0]=1000;} else{for_force[0]=0;}
if(key_cul){for_force[1]=500;} else{for_force[1]=0;}

phent_addforcelocal(my,for_force,my.x);

wait(1);

}

}
////code end

only this much so far.. but it isn't working smile

it works well initially and the car goes forward until i press the left key and it turns.. after the turn if i press the up arrow key it just spins on the ground instead of going forward.. i'm using 'addforcelocal' so it should give the force along the local 'x' axis.. i don't know why it gives something like a torque..

Re: adding local linear force rotates the entity.? [Re: noobie86] #208043
05/24/08 12:11
05/24/08 12:11
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
Why don't you apply the torque directly on the wheels (with phcon_setmotor)?


MfG, Christian__A. Visit my Site: www.chris-a.de



Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1