Offset any models that aren't centered

This commit is contained in:
Jarrod Doyle 2024-08-25 11:22:13 +01:00
parent ad68c25447
commit 655a188a69
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,6 @@ public partial class Model : Node3D
var b = (material.Handle) & 0xff; var b = (material.Handle) & 0xff;
var g = (material.Handle >> 8) & 0xff; var g = (material.Handle >> 8) & 0xff;
var r = (material.Handle >> 16) & 0xff; var r = (material.Handle >> 16) & 0xff;
GD.Print($"Handle: {material.Handle}, R: {r}, G: {g}, B: {b}");
var colour = new Color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f); var colour = new Color(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
materials.Add(new StandardMaterial3D materials.Add(new StandardMaterial3D
{ {
@ -108,7 +107,8 @@ public partial class Model : Node3D
} }
} }
var meshInstance = new MeshInstance3D { Mesh = mesh }; var pos = -modelFile.Header.Center.ToGodotVec3();
var meshInstance = new MeshInstance3D { Mesh = mesh, Position = pos };
AddChild(meshInstance); AddChild(meshInstance);
} }
} }