Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 1,085 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Make car stick to ground #427886
08/15/13 09:02
08/15/13 09:02
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline OP
Serious User
PadMalcom  Offline OP
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Hi, I've implemented a simple car physic using the example from the manual:

Code:
function simple_car(){
  ENTITY* car = ent_create("car.mdl",vector(100,-200,40),NULL); 
  pXent_settype(car,PH_RIGID,PH_BOX);
  ENTITY* FLwheel = ent_create("wheel.mdl",vector(168,-170,17),NULL);
  ENTITY* FRwheel = ent_create("wheel.mdl",vector(168,-230,17),NULL);
  ENTITY* BLwheel = ent_create("wheel.mdl",vector(39,-170,17),NULL);
  ENTITY* BRwheel = ent_create("wheel.mdl",vector(39,-230,17),NULL);
  pXcon_add ( PH_WHEEL, FLwheel, car, 0 );
  pXcon_add ( PH_WHEEL, FRwheel, car, 0 );
  pXcon_add ( PH_WHEEL, BLwheel, car, 0 );
  pXcon_add ( PH_WHEEL, BRwheel, car, 0 );//drive the car          while(1)  {
    pXcon_setwheel (FLwheel,-5,0,0);
    pXcon_setwheel (FRwheel,-5,0,0); // steer to the right
    pXcon_setwheel (BLwheel,0,500,0);    pXcon_setwheel (BRwheel,0,500,0);
    wait(1);  }}



My problem is, that the car does not stick to the ground and "falls" on the side quite often so that I can't continue driving. Any ideas how to avoid that?

Re: Make car stick to ground [Re: PadMalcom] #427888
08/15/13 09:23
08/15/13 09:23
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
For the problem of falling on the side you can try to lower the center of mass and you can also try to mess around with the interia via pXent_setmassoffset (ENTITY* entity , VECTOR* vOffset, VECTOR* vInertia).
With the "does not stick to ground"- problem I think you mean that the wheels dont touch the ground, thats probably due to the fact that PhysX does not update the wheel position as stated in the manual.
Quote:
PhysX does not return the position and angles of the wheel, thus leaving its calculation from the car orientation, suspension parameters, contact points, and axle speed as an excercise to the reader. Unfortunately, the axle speed returned by PhysX is wrong - it does not take wheel slip into account. It is not possible to calculate the 'real' axle speed from the wheel parameters, thus some approximations and educated guesses must be used.

Re: Make car stick to ground [Re: muffel] #427982
08/16/13 07:30
08/16/13 07:30
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline OP
Serious User
PadMalcom  Offline OP
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Thanks muffel, I'll try that!


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | 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