mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-19 05:27:21 -05:00
UpdateDelta
This commit is contained in:
parent
cc3568da14
commit
da4ae3f0e5
|
|
@ -13,27 +13,6 @@ namespace UniVRM10
|
|||
Vector3 m_delta;
|
||||
public override Vector3 Delta => m_delta;
|
||||
|
||||
protected override void UpdateDelta()
|
||||
{
|
||||
if (Source == null)
|
||||
{
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_src == null)
|
||||
{
|
||||
m_src = new ConstraintSource(Source, ModelRoot);
|
||||
}
|
||||
if (m_dst == null)
|
||||
{
|
||||
m_dst = new ConstraintDestination(transform, ModelRoot);
|
||||
}
|
||||
|
||||
m_delta = FreezeAxes.Freeze(m_src.TranslationDelta(SourceCoordinate));
|
||||
m_dst.ApplyTranslation(Delta, Weight, DestinationCoordinate, ModelRoot);
|
||||
}
|
||||
|
||||
public override TR GetSourceCurrent()
|
||||
{
|
||||
var coords = GetSourceCoords();
|
||||
|
|
@ -55,5 +34,11 @@ namespace UniVRM10
|
|||
|
||||
return new TR(Delta) * coords;
|
||||
}
|
||||
|
||||
protected override void UpdateDelta()
|
||||
{
|
||||
m_delta = FreezeAxes.Freeze(m_src.TranslationDelta(SourceCoordinate));
|
||||
m_dst.ApplyTranslation(Delta, Weight, DestinationCoordinate, ModelRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,6 @@ namespace UniVRM10
|
|||
|
||||
public override Vector3 Delta => m_delta.eulerAngles;
|
||||
|
||||
protected override void UpdateDelta()
|
||||
{
|
||||
m_delta = m_src.RotationDelta(SourceCoordinate, SourceOffset);
|
||||
}
|
||||
|
||||
public override TR GetSourceCurrent()
|
||||
{
|
||||
var coords = GetSourceCoords();
|
||||
|
|
@ -39,5 +34,18 @@ namespace UniVRM10
|
|||
|
||||
return coords * new TR(m_delta);
|
||||
}
|
||||
|
||||
protected override void UpdateDelta()
|
||||
{
|
||||
m_delta = m_src.RotationDelta(SourceCoordinate, SourceOffset);
|
||||
|
||||
// 軸制限
|
||||
var fleezed = FreezeAxes.Freeze(Delta);
|
||||
var rotation = Quaternion.Euler(fleezed);
|
||||
|
||||
// Debug.Log($"{delta} => {rotation}");
|
||||
// オイラー角を再度Quaternionへ。weight を加味してSlerpする
|
||||
m_dst.ApplyRotation(DestinationOffset * rotation, Weight, DestinationCoordinate, ModelRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,15 +204,6 @@ namespace UniVRM10
|
|||
|
||||
// 回転差分
|
||||
UpdateDelta();
|
||||
|
||||
// 軸制限
|
||||
var fleezed = FreezeAxes.Freeze(Delta);
|
||||
var rotation = Quaternion.Euler(fleezed);
|
||||
|
||||
// Debug.Log($"{delta} => {rotation}");
|
||||
// オイラー角を再度Quaternionへ。weight を加味してSlerpする
|
||||
m_dst.ApplyRotation(DestinationOffset * rotation, Weight, DestinationCoordinate, ModelRoot);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user