impl DstDrawModelCoords

This commit is contained in:
ousttrue
2021-04-28 19:15:21 +09:00
parent e7fe9af5b0
commit 864415f614
2 changed files with 21 additions and 5 deletions

View File

@@ -59,7 +59,10 @@ namespace UniVRM10
void DstDrawModelCoords()
{
var s = m_target.transform.lossyScale.x;
// init
Coords.Write(m_target.GetDstModelCoords(), 0.2f / s);
}
void DstDrawLocalCoords()
@@ -67,7 +70,7 @@ namespace UniVRM10
var s = m_target.transform.lossyScale.x;
// init
Coords.Write(m_target.GetDstLocalInit(), 0.2f / s);
Coords.Write(m_target.GetDstLocalCoords(), 0.2f / s);
}
#endregion

View File

@@ -41,15 +41,19 @@ namespace UniVRM10
/// <returns></returns>
public Matrix4x4 GetSourceModelCoords()
{
Matrix4x4 m = Matrix4x4.identity;
if (Source != null)
{
if (ModelRoot != null)
{
return ModelRoot.localToWorldMatrix * Matrix4x4.Translate(Source.position);
m = Matrix4x4.Rotate(ModelRoot.rotation);
}
}
return Matrix4x4.identity;
if (Source != null)
{
m *= Matrix4x4.Translate(Source.position);
}
return m;
}
/// <summary>
@@ -86,7 +90,16 @@ namespace UniVRM10
}
ConstraintDestination m_dst;
public Matrix4x4 GetDstLocalInit()
public Matrix4x4 GetDstModelCoords()
{
Matrix4x4 m = Matrix4x4.identity;
if (ModelRoot != null)
{
m = Matrix4x4.Rotate(ModelRoot.rotation);
}
return m * Matrix4x4.Translate(transform.position);
}
public Matrix4x4 GetDstLocalCoords()
{
if (m_src != null)
{