In today's release (Cool VL Viewer v220.127.116.11 with RestrainedLove v2.04.00.03), the definitive version of @adjustheight has been implemented, with an additional syntax beside the one already described above (@adjustheight:adjustement_in_centimeters=force which is still valid for constant offsets to use with (usually standing) animations not depending on the avatar shape).
You can now auto-correct the avatar height for a given animation via:
- ref_pelvis_to_foot_length_in_meters: the pelvis to foot length for which the animation is properly leveled with the floor.
- scalar: the multiplicator to apply to the difference between the said reference length and the current pelvis to foot length to obtain the proper avatar height adjustment offset and keep the animation leveled with the floor.
- optional_delta_in_meters: an optional (can be omitted) additional offset. It's normally unneeded, but could prove useful in some cases such as with prim-based avatars, or avatars with extremely thick or thin limbs (the thickness of the legs, for example, is not taken into account and a kneeling animation could then look badly leveled with some avatars while it's just the result of too thin (resulting in a slightly "floating" Av animation) or too thick (resulting in a slightly "sinking" Av animation) legs when compared with the reference shape that was used to find out the ref_pelvis_to_foot_length_in_meters)
The calculation done internally by @adjustheight is then
height_adjustment = (ref_pelvis_to_foot_length_in_meters - current_av_pelvis_to_foot_length_in_meters) * scalar + optional_delta_in_meters
and this "height_adjustment" value is added to the actual avatar height when the latter is passed to the sim server, resulting in a modification of the avatar level relatively to the floor.
Example, for the well known "nadu" kneeling anim:
Now, here is the "recipe" to find out what are "ref_pelvis_to_foot_length_in_meters" and "scalar" for a given animation (kneeling, crawling, lying, crouching, sitting anims... Standing anims normally don't depend on the avatar shape and would at worst need a constant height adjustment).
- First, make sure to use the Cool VL Viewer v18.104.22.168 or newer (or a viewer able to tell you what is the pelvis to foot height for the shape your avatar is wearing).
- Create a new shape in your inventory and "wear" it. This default shape (Ruth's shape) will be our reference (though theoretically, any shape should work, but for the limbs thickness issue: see the remark for "optional_delta_in_meters" above).
- Remove any shoes your avatar would be wearing (though theoretically, wearing shoes or not won't matter, but for the fact that with shoes on, you can't see whether or not the feet touch the floor for animations where feet must be in contact with it).
- Make sure the "avatar Z offset" (or whatever it is called in your viewer) is set to 0. In the Cool VL Viewer, you can adjust this offset manually and in real time from the spinner in the movement controls floater (open it from "View" -> "Movement Controls").
- Play the animation you want to find the parameters for. If the avatar is seen "floating" above the floor, its legs to pelvis length is too large, if it is seen "sinking" into the floor, it is too small.
- Right click on the Av and click on "Appearance..." to open the appearance editor floater. Now, play with the Body/Height parameter to change the "Pelvis to foot" value (seen at the bottom left of the floater for the Cool VL Viewer v22.214.171.124 and newer). You may also adjust the Legs/Leg length or Torso/Torso length parameters should you fail to reach the proper value for "Pelvis to foot" by just touching the Body/Height (a few animations seem to have been designed for insanely (and even impossibly) tall avatars...).
- Save the shape and close the floater, then verify how well the avatar is leveled with the ground.
- Repeat the above two steps till you find the exact matching pelvis to foot length by trial and error, and take note of that length (you just found ref_pelvis_to_foot_length_in_meters !).
- Now, set the Body/Height to zero and take note of the pelvis to foot length (let's call it "min_foot_to_pelvis"). Save the shape and close the appearance floater.
- Play the animation and use the "avatar Z offset" spinner in the movement controls floater (or whatever equivalent setting in your viewer) so to get the avatar properly leveled with the floor again. Take note of the corresponding "avatar Z offset" number (let's call it "min_size_offset") and do the following calculation: min_size_offset / (ref_pelvis_to_foot_length_in_meters - min_foot_to_pelvis). This number is "scalar".
- Now, set the Body/Height to 100 and take note of the pelvis to foot length (let's call it "max_foot_to_pelvis"). Save the shape and close the appearance floater.
- Play the animation and use the "avatar Z offset" spinner in the movement controls floater so to get the avatar properly leveled with the floor again. Take note of the corresponding "avatar Z offset" number (let's call it "max_size_offset") and do the following calculation: max_size_offset / (ref_pelvis_to_foot_length_in_meters - max_foot_to_pelvis). This number is "scalar" again and should be equal to the one you computed for min_foot_to_pelvis. If these numbers are not equal (taking only the first two decimals into account), then either one of the calculations was imprecise (may happen if ref_pelvis_to_foot_length_in_meters is too close from min_foot_to_pelvis or max_foot_to_pelvis: you should then value more the result obtained for the shape (min or max) that gave the largest foot to pelvis difference when compared to ref_pelvis_to_foot_length_in_meters), or you did something wrong...