Wheel Constraint Problem

Posted By: James Snydstrup

Wheel Constraint Problem - 06/10/03 23:18

Can anyone get parameter5 to work on a wheel constraint?

No matter how I try to limit the wheel rotation about axis2 using parameter5 the wheel can always make a full rotation when motorized.
Posted By: seb_dup1

Re: Wheel Constraint Problem - 06/10/03 23:46

you can't use parameter5 in ph_Wheel ;it stay always nullvector.
Posted By: James Snydstrup

Re: Wheel Constraint Problem - 06/10/03 23:58

I am beginning to find this physics engine very limiting. [Frown]

Why can't I set limits on both axis' of rotation of a wheel constraint?

Why can't I limit the rotation of an entity along the slider axis of a slider contraint? I just want it to slide not rotate.

Why can't I limit the rotation of a ball constraint around any of the axis'?

My path down frustration lane started with trying to make a brake for my vehicle wheels. The simple solution would be to just motor the wheels to 0 angular velocity with a high torque. However, on a steep slope the vehicle will still roll down hill with the brakes applied. This is due to the fact that contraints are allowed to shift out of their proper positions. I can fix that by adjusting the values of CFM or ERP but if I do that my brakes work but then my physics objects tend to randomly 'explode' and, of course, all the joints are too stiff.

No brakes yet...but I would appreciate if someone could give help out with some code that would generate a +1 or -1 to indicate whether a wheel is rotating clockwise or counterclockwise.
Posted By: Anonymous

Re: Wheel Constraint Problem - 06/11/03 03:40

quote:
Originally posted by James Snydstrup:
No brakes yet...but I would appreciate if someone could give help out with some code that would generate a +1 or -1 to indicate whether a wheel is rotating clockwise or counterclockwise.

How about sampling the wheel's tilt value at two consecutive frames and then pick the smaller angle difference to yield direction of movement?
E.g. if tilt1==10 and tilt2==60 then it could be a forward movement of 50 degrees or a backward movement of -310. Given low velocities and high framerate, the result should be the smaller one, i.e. 50 and thus it's moving forward.

As for constraint parameters (2nd axis limits, non-rotating slider, ball limits), I am sorry to tell you that there are no enhancements planned in the near future. One thing that's on my list is making the wheels more stable though.
Posted By: James Snydstrup

Re: Wheel Constraint Problem - 06/11/03 03:42

quote:
No brakes yet...but I would appreciate if someone could give help out with some code that would generate a +1 or -1 to indicate whether a wheel is rotating clockwise or counterclockwise.
Ok, got this one figured out. I used Ventilators script to get the local linear velocity and then normalized it to length 1. The trick is I had to rotate to the 'chassis' angles and not the 'wheel' angles. The wheel angles don't help since the wheels are always rolling along..doh! Wheel linear velocity rotated to chassis angles using...

code:
phent_getvelocity(wheel,vel,nullvector);
vec_rotate(vel,vector(-chassis.pan,-chassis.tilt,-chassis.roll));
vec_normalize (vel, 1);

quote:
One thing that's on my list is making the wheels more stable though.
More stable wheels would be nice. [Smile]

FYI: Parameter5 is documented in the manual for wheel axis2 so you might want to change the documentation.
© 2024 lite-C Forums