First of all sorry of my English ![]()
There is a rigidbody on my scene which is solely controlled by physics forces (Acceleration mode). Now I have problem with keeping rigidbody constant height over terrain. I want the object to be e.g. 10 meters above the terrain wherever it is and I am looking for optimal solution of calculating this vertical force (or something?), as setting position ‘by hand’ is unacceptable.
There is a project attached to this thread that shows how to float an object a constant height above ground (it’s actually for a camera, but it is easily applied to other objects). Basically, you measure the distance to ground with a raycast and then apply a force to counteract gravity if the object is too low.
It looks very useful, but I want to get rid of “spring moving”. Object should only change position to desired position as fast as possible (using physical forces) and don’t move anymore. That is my problem.
BTW there is no gravity
You can make this happen by tweaking the force and damping values. A large force, appropriately damped will move the object quickly without too much springiness.