Gamestudio Links
Zorro Links
Newest Posts
SGT_FW
by Aku_Aku. 11/30/26 08:19
Removing outliers from files
by JeyKey II. 11/29/26 10:01
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Quad), 5,691 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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