Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, juanex), 1,247 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19056 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
gs physics rotating wheel problem #281427
07/27/09 08:44
07/27/09 08:44
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
Hey, this is the code I'm using for the front wheels of my physics car.

// setup all 4 wheels
function InitWheel()
{
if (you.commonWheelHeight<=-100000) {
you.commonWheelHeight=my.z; // store z for other wheels to come
} else {
my.z=you.commonWheelHeight; // Set all wheels to same height
}
phent_settype(my, PH_RIGID, PH_SPHERE);
phent_setmass(my, you.massWheel, PH_SPHERE);
phent_setgroup(my, you.groupID);
phent_setfriction(my, you.fricWheel);
phent_setdamping(my, 15,you.dampWheel);
phent_setelasticity(my, 0, 100); // bounciness
you.wheelCounter+=1;
}

action FLInit()
{
var vecRight[3];
vec_set(vecRight,vector(0,-1,0)); // reset right vector (in case of level restart)
vec_rotate(vecRight, you.pan); // rotate right vector to correspond to car orientation

my.pan = 0;
my.passable = on;
while(!you) { wait(1);}
sleep(1);
InitWheel();
// make wheel constraint pointing up and towards center
you.wheelFL= phcon_add(PH_WHEEL, you, my);
phcon_setparams1(you.wheelFL, my.x, vector(0,0,1), vecRight);
phcon_setparams2(you.wheelFL, vector(0,0,0), nullvector, vector(you.suspensionERP, you.suspensionCFM,0));
my.passable = off;
}

The problem is when I start driving and turning my vehicle, sometimes the wheels start rotating weird and then turn back to the right position. Hope someone can see the problem in the code. Thanks anyway.

Re: gs physics rotating wheel problem [Re: molotov] #281430
07/27/09 09:32
07/27/09 09:32
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline
Senior Member
MPQ  Offline
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
The problem of uncontrolled rotating is often caused through wrong physics parameter. Try to reduce the gravity value or mass of your wheels.

Edit: I tried a lot and the solution for this problem seems to be the physics frame rate. The variable "ph_fps_max_lock" is set on 70 on default that the gamestudio physics is able to run on old/slow computers as well. For a really smooth quite complex physics car set this value on 300 or higher (depends on your pc, more than 500 will slow down very much!). I put this value after ph_setgravity. The problem of uncotrolled movement disappeared, the stearing is quite smooth.

Last edited by MPQ; 07/27/09 18:58.

new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: gs physics rotating wheel problem [Re: MPQ] #281793
07/28/09 18:15
07/28/09 18:15
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
Hey MPQ, I've tryed your option but it remains the same, the wheels still turn to weird angles. Thanks anyway.

Re: gs physics rotating wheel problem [Re: molotov] #281800
07/28/09 18:39
07/28/09 18:39
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline
Senior Member
MPQ  Offline
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
thats strange, maybe your tires are oversized. The bigger the wheels the bigger the problem of weird angles wink

which values for ph_fps_max_lock did you try.


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: gs physics rotating wheel problem [Re: MPQ] #281970
07/29/09 17:43
07/29/09 17:43
Joined: Apr 2006
Posts: 329
M
molotov Offline OP
Senior Member
molotov  Offline OP
Senior Member
M

Joined: Apr 2006
Posts: 329
I've tryed smaller tires, but it remains the same. With ph_fps_max_lock I tryed the values, 30, 100 and 300. 100 and 300 gave no result and with 30 it just became weird. Could it also be a problem with my type of computer?

Re: gs physics rotating wheel problem [Re: molotov] #281973
07/29/09 17:55
07/29/09 17:55
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline
Senior Member
MPQ  Offline
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
"ph_fps_max_lock" sets how often a physics entity is updated and how often collision is detected within a second (default 70). Try out a high value like 500, if it does not slow down too much.

Last edited by MPQ; 07/29/09 18:04.

new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: gs physics rotating wheel problem [Re: MPQ] #282106
07/30/09 12:04
07/30/09 12:04
Joined: Apr 2008
Posts: 31
C
Chrisu Offline
Newbie
Chrisu  Offline
Newbie
C

Joined: Apr 2008
Posts: 31
What you described is sadly but true an old problem that has been talked about a lot but never got solved by ????????

I.E.: http://www.opserver.de/ubb7/ubbthreads.p...true#Post231560

If anyone got a THE solution for this I may finally continue the work on my game I once started and for which I initially bought 3DGS.

Re: gs physics rotating wheel problem [Re: Chrisu] #282162
07/30/09 15:15
07/30/09 15:15
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline
Senior Member
MPQ  Offline
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
ok, try this tutorial and change ph_fps_max_lock to 500 inside the script! Try 300 (default) as well. You will see the difference!

Link to tutorial

300 --> uncontrolled rotation
500 --> smooth

at least at my place --> please try!



Last edited by MPQ; 07/30/09 15:54.

new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: gs physics rotating wheel problem [Re: MPQ] #282171
07/30/09 16:11
07/30/09 16:11
Joined: Apr 2008
Posts: 31
C
Chrisu Offline
Newbie
Chrisu  Offline
Newbie
C

Joined: Apr 2008
Posts: 31
thx, i will try this tonight

Re: gs physics rotating wheel problem [Re: Chrisu] #282214
07/30/09 19:57
07/30/09 19:57
Joined: Apr 2008
Posts: 31
C
Chrisu Offline
Newbie
Chrisu  Offline
Newbie
C

Joined: Apr 2008
Posts: 31
tried it!

though it really gets a bit better there are still times where the steering wheels go crazy ;-(

Page 1 of 2 1 2

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