I remember I wrote (some months ago) a game similar to wipeout with a constant force to be applied from the ground. This was prototype wrote for testing only.
The vertical push force was not stable and wobble a lot. I solved this by using a simple PID controller :
Code:distance_target = 5.0 //we want object to be always 5 units above the floor distance_to_ground = cast a ray from object to the floor error = distance_target - distance_to_ground derivative = error - last_error // kp and kd are constants to be adjusted (stability vs speed) force_to_apply = error * kp + derivative * kd last_error = error




Reply With Quote