mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-10-02 15:53:30 -05:00
GetSourceCurrent
This commit is contained in:
@@ -20,12 +20,9 @@ namespace UniVRM10
|
||||
void DrawSourceCurrent()
|
||||
{
|
||||
var s = m_target.transform.lossyScale.x;
|
||||
|
||||
// current
|
||||
Handles.matrix = m_target.Source.localToWorldMatrix;
|
||||
Handles.matrix = m_target.GetSourceCurrent().TRS(0.05f * s);
|
||||
Handles.color = Color.yellow;
|
||||
var size = 0.05f / s;
|
||||
Handles.DrawWireCube(Vector3.zero, new Vector3(size, size, size));
|
||||
Handles.DrawWireCube(Vector3.zero, Vector3.one);
|
||||
}
|
||||
|
||||
void DrawSourceCoords()
|
||||
|
||||
@@ -34,10 +34,9 @@ namespace UniVRM10
|
||||
{
|
||||
switch (coords)
|
||||
{
|
||||
// 右からかけるか、左からかけるか、それが問題なのだ
|
||||
// case SourceCoordinates.World: return m_transform.rotation * Quaternion.Inverse(m_initial.Rotation);
|
||||
case ObjectSpace.local: return m_transform.localRotation * Quaternion.Inverse(LocalInitial.Rotation);
|
||||
case ObjectSpace.model: return m_transform.rotation * Quaternion.Inverse(ModelRoot.rotation) * Quaternion.Inverse(ModelInitial.Rotation);
|
||||
case ObjectSpace.model: return m_transform.rotation * Quaternion.Inverse(ModelInitial.Rotation) * Quaternion.Inverse(ModelRoot.rotation);
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,61 @@ namespace UniVRM10
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public TR GetSourceCurrent()
|
||||
{
|
||||
switch (SourceCoordinate)
|
||||
{
|
||||
case ObjectSpace.model:
|
||||
{
|
||||
var r = Quaternion.identity;
|
||||
if (Source != null)
|
||||
{
|
||||
if (ModelRoot != null)
|
||||
{
|
||||
r = ModelRoot.rotation;
|
||||
if (m_src != null)
|
||||
{
|
||||
r *= m_src.RotationDelta(ObjectSpace.model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var t = Vector3.zero;
|
||||
if (Source != null)
|
||||
{
|
||||
t = Source.position;
|
||||
}
|
||||
|
||||
return new TR(r, t);
|
||||
}
|
||||
|
||||
case ObjectSpace.local:
|
||||
{
|
||||
if (Source != null)
|
||||
{
|
||||
if (m_src != null)
|
||||
{
|
||||
// runtime
|
||||
var parent = TR.Identity;
|
||||
if (Source.parent != null)
|
||||
{
|
||||
parent = TR.FromWorld(Source.parent);
|
||||
}
|
||||
return parent * m_src.LocalInitial;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TR.FromWorld(Source);
|
||||
}
|
||||
}
|
||||
|
||||
return TR.Identity;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Quaternion Delta
|
||||
{
|
||||
get;
|
||||
|
||||
Reference in New Issue
Block a user