Closed sabresaurus closed 3 years ago
Awesome!
Only thing I noticed is auto-fit not working with scaled or rotated deformables in an LOD Group
Looks like changing this
if (deformable != null)
{
var bounds = deformable.GetCurrentMesh().bounds;
transform.localPosition = bounds.center;
transform.localScale = bounds.size;
// Make sure the rotation is zeroed so that we're not applying the size is the wrong axis
transform.localRotation = Quaternion.identity;
}
to this works. Perhaps there's a better way to do it without lossy scale tho
if (deformable != null)
{
var bounds = deformable.GetCurrentMesh().bounds;
var rendererTransform = deformable.GetRenderer().transform;
transform.localPosition = bounds.center;
transform.localScale = Vector3.Scale(bounds.size, rendererTransform.lossyScale);
transform.localRotation = rendererTransform.rotation;
}
Thanks, fix applied