Ph_wheel constraint isn't working correct sometime

Posted By: Olzii

Ph_wheel constraint isn't working correct sometime - 05/17/06 06:00

Hi Marco,

My car wheel's 's ph_wheel constraints goes crazy sometimes. Ph_wheel has some angle limits, but it will ignore it sometimes. You can see it here : a6 car (Please use left and right key to steer when car is stopped and it will happen. )

I was ok before at 6.314. I think it is from new physics improvements.

Please tell me how to correct it. Is it a bug ?

Olzii
Posted By: Marco_Grubert

Re: Ph_wheel constraint isn't working correct some - 05/17/06 18:58

I can reproduce the problem by turning the wheels all the way to one direction and then all the way in the other direction. But without the C-Script code it's hard to say what the cause is.
I also noticed that you are creating the car partially inside the level. Make sure that the car starts on top of the floor.
Posted By: Olzii

Re: Ph_wheel constraint isn't working correct some - 05/18/06 07:32

Here is code :

1. Constraint create
you.wheelFL= phcon_add(PH_WHEEL, you, my);
phcon_setparams1(you.wheelFL, my.x, vecUp, vecRight);
phcon_setparams2(you.wheelFL, vector(0,0,0), nullvector, vector(you.suspensionERP, you.suspensionCFM,0));

2. Turning code
my.targetSteer=clamp(my.targetSteer,-40,40);
phcon_setparams2(my.wheelFL, vector(my.targetSteer,my.targetSteer,0), nullvector, vector(my.suspensionERP, my.suspensionCFM,0));
phcon_setparams2(my.wheelFR, vector(my.targetSteer,my.targetSteer,0), nullvector, vector(my.suspensionERP, my.suspensionCFM,0));

It does not matter that where is car creating. I have tried it.

Olzii
Posted By: Olzii

Re: Ph_wheel constraint isn't working correct some - 05/18/06 08:36

Here is screenshots:



It will happen when i press left or right key until wheel steering reaches maximum angle. It will not happen if i make maximum steering angle to 30.

my.targetSteer=clamp(my.targetSteer,-30,30); // it is OK

But steering angle 30 is not enough for car steering.

Olzii
Posted By: Olzii

Re: Ph_wheel constraint isn't working correct some - 05/19/06 10:23

Hi Marco,

You have requested code and i posted code and images. Why you dont answer ?
May be i should write these questions on beta forum ?

Olzii
Posted By: FoxHound

Re: Ph_wheel constraint isn't working correct some - 05/19/06 14:45

Does this still happen with 6.40.5?
Posted By: Marco_Grubert

Re: Ph_wheel constraint isn't working correct some - 05/19/06 21:22

Okay it seems that the PH_WHEEL does not like to be overly constrained. I am getting the same problem with 6.40.5 but it goes away when I change the code to this:

phcon_setparams2(my.wheelFL, vector(my.targetSteer-2,my.targetSteer+2,0), nullvector, vector(my.suspensionERP, my.suspensionCFM,0));
phcon_setparams2(my.wheelFR, vector(my.targetSteer-2,my.targetSteer+2,0), nullvector, vector(my.suspensionERP, my.suspensionCFM,0));
Posted By: Olzii

Re: Ph_wheel constraint isn't working correct some - 05/20/06 04:16

Wow, it goes away. Thanks Marco.

Why ? I dont understand purpose of adding +2, -2.

Olzii
Posted By: Marco_Grubert

Re: Ph_wheel constraint isn't working correct some - 05/22/06 20:48

Internally what the physics engine does is it solves dozens of equations. Due to machine precision some of these equations are ill-formed, e.g. when you're trying to solve
x-1=0 and x-1.1=0
at the same time you won't be able to come to a satisfying solution which visually means that the physics object will do something weird. The whole point of setting correction factors and adding the +/-2 values above is to allow for a fudge factor so that a satisfying solution can be found. Essentially you are now telling the PH_WHEEL that they should point roughly in the right direction as opposed to forcing them to be 100% aligned which leads to instability.
© 2024 lite-C Forums