Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,631 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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