mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-27 05:12:32 -05:00
Merge pull request #1312 from ousttrue/fix10/migrate_with_scaling
[1.0] Scale 対応
This commit is contained in:
@@ -49,6 +49,10 @@ namespace UniGLTF
|
||||
public static (Vector3, float) GetAxisAngle(this Quaternion q)
|
||||
{
|
||||
var qw = q.W;
|
||||
if (qw == 1)
|
||||
{
|
||||
return (Vector3.UnitX, 0);
|
||||
}
|
||||
var angle = 2 * Math.Acos(qw);
|
||||
var x = q.X / Math.Sqrt(1 - qw * qw);
|
||||
var y = q.Y / Math.Sqrt(1 - qw * qw);
|
||||
|
||||
@@ -648,12 +648,16 @@ namespace UniVRM10
|
||||
public static void CreateNodes(VrmLib.Node node, GameObject parent, Dictionary<VrmLib.Node, GameObject> nodes)
|
||||
{
|
||||
GameObject go = new GameObject(node.Name);
|
||||
go.transform.SetPositionAndRotation(node.Translation.ToUnityVector3(), node.Rotation.ToUnityQuaternion());
|
||||
nodes.Add(node, go);
|
||||
|
||||
// world
|
||||
go.transform.SetPositionAndRotation(node.Translation.ToUnityVector3(), node.Rotation.ToUnityQuaternion());
|
||||
if (parent != null)
|
||||
{
|
||||
go.transform.SetParent(parent.transform);
|
||||
go.transform.SetParent(parent.transform, true);
|
||||
}
|
||||
// local
|
||||
go.transform.localScale = node.LocalScaling.ToUnityVector3();
|
||||
|
||||
if (node.Children.Count > 0)
|
||||
{
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace UniVRM10
|
||||
{
|
||||
node.LocalRotation = x.rotation.ToQuaternion();
|
||||
}
|
||||
if (x.scale != null && x.scale.Length == 4)
|
||||
if (x.scale != null && x.scale.Length == 3)
|
||||
{
|
||||
node.LocalScaling = x.scale.ToVector3(Vector3.One);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user