fix: incorrect scaling for Visible Head Accessory (#412)

This commit is contained in:
bd_ 2023-09-03 18:10:17 +09:00 committed by GitHub
parent 8251f3fcf7
commit b155202714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,12 +85,6 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
var proxy = CreateProxy(); var proxy = CreateProxy();
var xform = target.transform;
var pscale = proxy.lossyScale;
var oscale = xform.lossyScale;
xform.localScale = new Vector3(oscale.x / pscale.x, oscale.y / pscale.y, oscale.z / pscale.z);
target.transform.SetParent(proxy, true); target.transform.SetParent(proxy, true);
didWork = true; didWork = true;
@ -122,6 +116,7 @@ namespace nadena.dev.modular_avatar.core.editor
obj.transform.localPosition = src.localPosition; obj.transform.localPosition = src.localPosition;
obj.transform.localRotation = src.localRotation; obj.transform.localRotation = src.localRotation;
obj.transform.localScale = src.localScale; obj.transform.localScale = src.localScale;
Debug.Log($"src.localScale = {src.localScale} obj.transform.localScale = {obj.transform.localScale}");
var constraint = obj.AddComponent<ParentConstraint>(); var constraint = obj.AddComponent<ParentConstraint>();
constraint.AddSource(new ConstraintSource() constraint.AddSource(new ConstraintSource()
@ -136,6 +131,8 @@ namespace nadena.dev.modular_avatar.core.editor
_proxyHead = obj.transform; _proxyHead = obj.transform;
// TODO - lock proxy scale to head scale in animation?
return obj.transform; return obj.transform;
} }