Physics and a car

Posted By: fangedscorpion

Physics and a car - 07/23/09 16:25

I have a car model and I wanted to move it using physics. I already checked the manual and I typed in my code. When I try to drive the car around, the car moves unrealistically and flips over. I plan to have wheels for the car, so would I set the wheels as the collision object. The code for my car can be seen here:

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=34262&Number=280217#Post280217

Thanks!
Posted By: MPQ

Re: Physics and a car - 07/23/09 20:22

I do not really understand what kind of car model you are using. For a quite realistic car you have to use constraints (e.g. four wheels one chassis)
Posted By: fangedscorpion

Re: Physics and a car - 07/23/09 21:10

How do I accomplish this?

I have a chassis already built and I want to move it correctly.
Posted By: Jaeger

Re: Physics and a car - 07/24/09 03:23

I answered your other post. No need to make multiple posts in different sections on the same topic. Someone will help if they know the answer and have time.

I'm also interested in how to set up physics constraints for wheels and the likes. There are no tutorials or good examples, and the manual's explanation is virtually useless.

Btw, I see you are new. Is this your first project? If so, I'd suggest you try some simpler things first and come back to this. Physics can be rather frustrating, and nearly impossible for beginners to work with. But maybe you're just new to the forums. Dunno. Anyway, I hope someone can help. I need to know the same thing, and I've already got experience with the physics engine. Just no knowledge of constraints and wheels, etc, because there's virtually no info on it, and I've never gotten an answer here.
Posted By: MPQ

Re: Physics and a car - 07/24/09 07:06

If you like I write a little tutorial about car physics. Please answer if you like one.

Gamestudio Physics can be quite frustrating. At the moment i work on a racing game and it really needs a lot of time to get good results. At the moment i am working on it.
Posted By: fangedscorpion

Re: Physics and a car - 07/25/09 14:54

That would be so helpful man! Thanks for the help!
If possible could you try to write it in english or comment lines in english plaese? Thanks again!
Posted By: MPQ

Re: Physics and a car - 07/25/09 20:14

tutorial which explains the usage of constraints by means of an example:

3DGS CAR PHYSICS TUTORIAL ver 0.1


3DGS PHYSICS CAR TUTORIAL ver. 0.2

- some mistakes corrected
- static camera added

3DGS CAR PHYSICS TUTORIAL ver. 0.2.1

- pdf mistake removed

I think there are many mistakes inside the text, maybe tell me if you find some. Thanks
Posted By: fangedscorpion

Re: Physics and a car - 07/29/09 04:16

what is wrong with this code?

var w1id;
var w2id;
var w3id;
var w4id;

var axis[3] = 0,1,0;
//var axis2[3] = 0,1,0;
//var axis3[3] = 0,1,0;
//var axis4[3] = 0,1,0;

var con1[3];
var con2[3];
var con3[3];
var con4[3];

vec_set(con1, w1.x );
vec_set(con2, w2.x );
vec_set(con3, w3.x );
vec_set(con4, w4.x );

con1.z = moke1.z - 50;
con2.z = moke1.z - 50;
con3.z = moke1.z - 50;
con4.z = moke1.z - 50;

w1id = phcon_add( PH_WHEEL, moke1,w1);
phcon_setparams1(w1id,con1,axis,NULL);
w2id = phcon_add( PH_WHEEL, moke1,w2);
phcon_setparams1(w1id,con2,axis,NULL);
w3id = phcon_add( PH_WHEEL, moke1,w3);
phcon_setparams1(w1id,con3,axis,NULL);
w4id = phcon_add( PH_WHEEL, moke1,w4);
phcon_setparams1(w1id,con4,axis,NULL);

I can not figure out this. It says there is an error with the first var axis[3] thing. what is wrong?
Posted By: MPQ

Re: Physics and a car - 07/29/09 06:16

use for vectors definitions: var axis[3] = {0,1,0}; or VECTOR* axis = {x = 0; y = 1; z = 0;}
Posted By: MPQ

Re: Physics and a car - 08/14/09 09:21

The fileqube servers have a problem at the moment :), so here the new download link to version 0.3

3DGS CAR PHYSICS TUTORIAL VERSION 0.3

- some mistakes fixed
Posted By: MarcsVision

Re: Physics and a car - 09/17/09 17:02

if you dont mind me asking. but what kind of car game are u building? I'm stuck on trying to give my car a acceleration. what did you do?
Posted By: MPQ

Re: Physics and a car - 10/07/09 08:22

@MarcsVision: check up the tut and you´ll see

here the new download link (easier to download):

3DGS BASIC PHYSICS CAR TUTORIAL Version 0.3
Posted By: Neo283

Re: Physics and a car - 10/24/09 14:31

Danke für 3DGS BASIC PHYSICS CAR TUTORIAL Version 0.3 laugh

DANKE DANKE DANKE laugh laugh laugh
Posted By: MPQ

Re: Physics and a car - 08/22/10 21:58

thats nice that it helps! there are some mistakes in the tut but I think it gives you a good overview
© 2023 lite-C Forums