Sensitivity > Margin, Radius on bhk collision Shapes invalid conversion and erronous automatic calculation #646
Labels
Bug
Issue with specific functionality not working as intended but overall plugin is working.
Radius gets imported to Sensitivity > Margin.
If a mesh collision (bhkPackedNiTriStripShape, for example) gets imported Sensitivity > Margin gets set to ridiculous values (which is fine with mesh collision as it doesn't appear to be used for it anyway)
With other collison Shape types, which do have a Radius it gets set to shape Radius divided by 1/7, without Scale Correction, then on export something else happens that results in a completely different value being exported
Example: shape has 0.1 Radius, after import (any Scale Correction) it's 0.699913m in Blender, after export (any Scale Correction) it erronously gets auto-calculated and isn't based on Sensitivity > Margin at all (I tested it on a mesh with three bhkBoxShapes - they got set to 0.013094, 0.012548, 0.012902; they all had Radius of 0.1 and they all imported with 0.699913m Sensitivity > Margin)
It probably should be multiplied by Scale Correction and then on export divided by Scale Correction, without the 1/7 at all.No idea what's the deal with the 1/7, it matches 10 * 0.0142875 (correct scale unit to meter scale), so it could be that it's hardcoded to somehow match the 0.1 default Scale Correction, but that's not at all what it does, the result is only correct if you import with 1/7 Scale Correction.No idea what happens on export, seems the values are automatically calculated, which is wrong since shape radius is padding, not a radius, as #56 says.
The invalid automatic radius calculation should be removed from collision shape export and the value used should be
Sensitivity > Margin divided by Scale Correction.EDIT: Turns out I suck at math and the 1/7 (or rather 0.142875) is indeed neccessary and the havok units are decimeters.
The margin should be
margin = (radius * scale_correction) / 0.142875
and the radius
radius = (margin / scale_correction) / 0.142875
The text was updated successfully, but these errors were encountered: