Merge pull request #1826 from Santarh/uvAnimSpeed

Fix uv rotation coords of vrm-1.0
This commit is contained in:
ousttrue
2022-09-26 18:03:53 +09:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -152,7 +152,11 @@ namespace UniVRM10
const float invertY = -1f;
mtoon.UvAnimationScrollYSpeedFactor = context.UvAnimationScrollYSpeedFactor * invertY;
}
mtoon.UvAnimationRotationSpeedFactor = context.UvAnimationRotationSpeedFactor;
// Speed unit Conversion
const float rotationPerSecToRadianPerSec = Mathf.PI * 2f;
// Coords conversion
const float unityToGltfCoordsConversion = -1f;
mtoon.UvAnimationRotationSpeedFactor = context.UvAnimationRotationSpeedFactor * rotationPerSecToRadianPerSec * unityToGltfCoordsConversion;
// Texture Transforms
var scale = context.TextureScale;

View File

@@ -224,7 +224,11 @@ namespace UniVRM10
var uvAnimSpeedRotation = mToon?.UvAnimationRotationSpeedFactor;
if (uvAnimSpeedRotation.HasValue)
{
yield return (MToon10Prop.UvAnimationRotationSpeedFactor.ToUnityShaderLabName(), uvAnimSpeedRotation.Value);
// Speed unit Conversion
const float radianPerSecToRotationPerSec = 1f / (Mathf.PI * 2f);
// Coords conversion
const float gltfToUnityCoordsConversion = -1f;
yield return (MToon10Prop.UvAnimationRotationSpeedFactor.ToUnityShaderLabName(), uvAnimSpeedRotation.Value * radianPerSecToRotationPerSec * gltfToUnityCoordsConversion);
}
// UI