Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (SBGuy, Quad), 768 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: Car racing - Physics [Re: 3run] #382570
09/09/11 14:19
09/09/11 14:19
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
From first person perspective it looks quiet cool. With the 3rd person camera you see that the car has not much grip wink

Re: Car racing - Physics [Re: HeelX] #382575
09/09/11 15:20
09/09/11 15:20
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline OP
User
Carloos  Offline OP
User

Joined: Mar 2005
Posts: 514
Brazil
Yeah, It doesnt looks realistic. And also, it doesnt have much grip.

I made a mistake in the track modelling. I tryed to make the center of the track a little higher then the part closer to the grass.

This is making the physics react strange.
When the car goes into the turns, and even in the straight part, It changes direction a lot.

Only for fun, I will model another track, completely flat from side to side, to see what happens.

I Think the next step will be what Ventilator said : c-lite for the movement, physics for the collisions.

If I could manage the speed, turns and skkiding with Lite-c and, the PhysX for the collisions, I would get something nice.

I have a nice car behaviour wrote in c-script that I can port to c-lite easily.

My dount is : I know that we cant c_move a physics active object. Apart of this, I think... when the car collide with something, or another car... what could happen ? How to manage it ? Any ideas ?

Questions, too much questions.

Re: Car racing - Physics [Re: Carloos] #382622
09/10/11 11:16
09/10/11 11:16
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Is your car the standard raycast car? If yes you can adjust the grip on the track with car_frictionLatF and car_frictionLatR. The default values are a little too small when the car is heavy.

Re: Car racing - Physics [Re: Tobias] #382623
09/10/11 11:37
09/10/11 11:37
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I.ve faced problem with turning on flat levels too, they were made out of level blocks. I've seen that problem with another car examples which aren't made by me. May be that some kind of physX bug in game studio? Knights on wheels from samples folder has that problem as well...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Car racing - Physics [Re: Tobias] #382638
09/10/11 16:05
09/10/11 16:05
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline OP
User
Carloos  Offline OP
User

Joined: Mar 2005
Posts: 514
Brazil
Hi Tobias.

It Looks like this. I will check it later. Now I´m finishing a new track, better modelled, to work in the physics part without worry about imperfections in the asphalt.

Thanx for your tip.

Re: Car racing - Physics [Re: Carloos] #383123
09/16/11 02:33
09/16/11 02:33
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline OP
User
Carloos  Offline OP
User

Joined: Mar 2005
Posts: 514
Brazil
This is being very difficult to understand / implement.

I´m using this code I found somewhere in the forums, and changed a few things to my convenience, but nothing that could break its functionallity :

______________________________________________________________

function simple_car()
{
vecGravity.x = 0;
vecGravity.y = 0;
vecGravity.z = -9.81;

pX_setgravity (vecGravity);

ENTITY* car = ent_create("F3.mdl",vector(6700,25500,5),NULL);

pXent_settype(car,PH_RIGID,PH_CONVEX);
pXent_setmass(car,1);

car.material = mtl_envmirror;
car.shadow = ON;

pXent_setmassoffset(car,vector(NULL,NULL,-3),vector(1,0.1,1)); //moves the center of mass 10 quants down.

ENTITY* BLwheel = ent_create("tyre.mdl",vector(car.x - 60,car.y - 20,car.z + 8 ),mass);
ENTITY* BRwheel = ent_create("tyre.mdl",vector(car.x - 60,car.y + 20,car.z + 8),mass);
ENTITY* FLwheel = ent_create("tyre.mdl",vector(car.x + 46 ,car.y - 25,car.z + 8),mass);
ENTITY* FRwheel = ent_create("tyre.mdl",vector(car.x + 46,car.y + 25,car.z + 8),mass);

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 );

pXcon_setparams2(BRwheel, NULL,vecBRwheel, vecBRwheel2);
pXcon_setparams2(BLwheel, NULL,vecBLwheel, vecBLwheel2);
pXcon_setparams2(FRwheel, NULL,vecFRwheel, vecFRwheel2);
pXcon_setparams2(FLwheel, NULL,vecFLwheel, vecFLwheel2);

while(1)
{

if(key_a)
{
speed += (1 * time_step);
}
else
{
if ( speed > 0
{
speed -= (1 * time_step);
}
}

if(key_z)
{
speed -= (1 * time_step);
}

if(key_n)
{
tyreAngle -= ( 2 * time_step) ;
}
else
{
if (tyreAngle < 0)
{
tyreAngle += ( 1 * time_step) ;
}
}


if(key_m)
{
tyreAngle +=( 2 * time_step);
}
else
{
if (tyreAngle > 0)
{
tyreAngle -= ( 1 * time_step) ;
}
}


pXcon_setwheel (FLwheel,tyreAngle,0,0);
pXcon_setwheel (FRwheel,tyreAngle,0,0); // steer to the right
//pXcon_setwheel (BLwheel,0,speed,0);
//pXcon_setwheel (BRwheel,0,speed,0);

var max_speed = 300;
var ang_force = speed * 100;

//pXcon_setmotor(car,vector(-ang_force, max_speed, 0), nullvector);
//pXcon_setmotor(car,vector(-ang_force, max_speed, 0), nullvector);

pXent_addvelcentral(car,vector(((speed) * time_step),0,0));
pXent_addvelcentral(car,vector(0,0,-10));

pXent_addvelcentral(FLwheel,vector(0,0,-50));
pXent_addvelcentral(FRwheel,vector(0,0,-50));
pXent_addvelcentral(BLwheel,vector((speed),0,0));
pXent_addvelcentral(BRwheel,vector((speed),0,0));

var temp[1];
var camTilt;
var camPan;
var cam_dist=0;
var CamFromWheel = 10;
var CamFromGround = 5;
var x_cam;

camera.arc = 72;
camera.clip_near = 0;
camera.clip_far = 100000;
camTilt = car.tilt ;
camPan = car.pan - 180 ;
cam_dist = clamp(0,CamFromWheel,20);
camera.x = ((((car.x))+ cos(camPan)*(cam_dist*cos(camTilt)))) + x_cam ;
camera.y = ((car.y + sin(camPan)*((cam_dist*cos(camTilt)))));
camera.z = car.z + 20 ;
vec_set(temp,car.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);
camera.tilt = -3;
wait(1);
}
}


______________________________________________________________

but... an interesting thing is happening :

When the car is pointint to positive x vector, and I´m pressing the "a" key, it accelerates ok. then I turn 180 degrees in the track, and the orientation of the car is the opposite.

Then the car slows very fast, and it start to go in reverse !

It´s very disappointing, I know I´m very nooby in the PhisX thing, maybe also in coding, but this is so... weird...

Ipm really interested in learning and maybe applying what Ventilator said, but, if I can´t even manage to understand well this code above...

Well, any help or tips will be HIGHLY appreciated.

Cya

Re: Car racing - Physics [Re: Carloos] #383137
09/16/11 10:21
09/16/11 10:21
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
take a look at my PhysX car script in Aum 101


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Car racing - Physics [Re: painkiller] #383150
09/16/11 12:02
09/16/11 12:02
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline OP
User
Carloos  Offline OP
User

Joined: Mar 2005
Posts: 514
Brazil
Thankyou, Painkiller.

I will check it tonight.

Re: Car racing - Physics [Re: painkiller] #383151
09/16/11 12:13
09/16/11 12:13
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline OP
User
Carloos  Offline OP
User

Joined: Mar 2005
Posts: 514
Brazil
Is it in the download part of the AUM 101 ?

Re: Car racing - Physics [Re: Carloos] #383152
09/16/11 12:46
09/16/11 12:46
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Yes, here aum101code\hot_forum\Painkiller - 2nd\PhysX_car_code

Page 3 of 4 1 2 3 4

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