constraint problem

gdlk
Posts: 62
Joined: Fri Oct 24, 2014 7:01 pm

constraint problem

Post by gdlk »

Hi!

I am making a forklift, and I have a odd problem with the constraint (or I think it could be the constraints)

The forklift works fine when I want to take loads or move it, however, if the forks of the forklift touch the floor, the forklift start to move back.

In the next image, in the left, the vehicle is a btRaycastVehicle. Next there is a cube (call boom) with a hinge constraint to the vehicle. After that, there is 2 slider constraint, one to elevate the forks and other to move the forks (elevate constraint is between the boom and other cube (call base). The another slider is between the base and the fork.

Image

In the right of the image is the case where the problem happens. The solver is the SI, constraints has 200 iterations, stepSimulation is called with 50 maxSubSteps and fixedTimeStep of 1.0/120.0 (fps are not a problem). The mass ratio between vehicle and boom, base or fork is 1:5 (so mass ratio boom:base:fork is 1:1:1). Forks has ccd activate.

Any suggestion what could be? (currently I am short of ideas to try D=, so any idea about what try would be nice)

Thanks!!
gdlk
Posts: 62
Joined: Fri Oct 24, 2014 7:01 pm

Re: constraint problem

Post by gdlk »

bump

some idea? =(
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: constraint problem

Post by drleviathan »

It sounds like the reverse motion of the forklift is a result of a slight oscillation of the solution of the system of constraints and how that interacts with details of the contact points with the floor. I note that in the problem image the forklift's front wheels appear to be off the floor, so it rests on its back wheels and the tip of the forks. The constraints complete the arc.

Dunno if these would work, but here are the ideas that occur to me:

(1) Reduce the restitution of the base to 0.0 (You don't need it to bounce do you?) and increase its friction while decreasing the friction of the fork. These changes may affect other aspects of your game play so dial with caution and test normal operations. Maybe a sweet spot can be found.

(2) Reduce the restitution of the fork itself and also the floor as much as you're willing to go.

(3) Change the collision shape of the forks so that they aren't so pointy where they hit the ground (the collision shapes of objects don't have to match the visible shapes exactly). Ideally the forks should make a wide footprint with the ground when they touch in that configuration, with a contact point as close to the hinge side as possible -- this might reduce the torque on the constraints and make them vibrate less.
gdlk
Posts: 62
Joined: Fri Oct 24, 2014 7:01 pm

Re: constraint problem

Post by gdlk »

Thanks for the tips!

I try all that, but any work =(