diff --git a/client/BodyRenderer.cs b/client/BodyRenderer.cs index 5522126..508c3eb 100644 --- a/client/BodyRenderer.cs +++ b/client/BodyRenderer.cs @@ -22,6 +22,9 @@ public partial class BodyRenderer : Node3D /// What the puppet's mesh is made of now, or null while it draws none. public PuppetShape? PuppetShape => _puppet.Shape; + /// The world centre of the puppet's drawn bounds, or null before the first draw: where the camera orbits. + public Vector3? PuppetCentre => _puppet.Centre; + /// How many times the puppet's Godot mesh has been built. public int PuppetMeshBuilds => _puppet.MeshBuilds; diff --git a/client/Puppet.cs b/client/Puppet.cs index 0834dba..e4ecdae 100644 --- a/client/Puppet.cs +++ b/client/Puppet.cs @@ -57,6 +57,9 @@ public partial class Puppet : Node3D /// What the puppet is made of now, or null before the first build or while it draws nothing (too many bodies). public PuppetShape? Shape => _model.Shape; + /// The world centre of the puppet's drawn bounds (the mesh's CustomAabb, in the skin's space), or null before the first draw. + public Vector3? Centre => _mesh is { CustomAabb: { } box } && box.HasSurface() ? _skin.GlobalTransform * (box.Position + box.Size / 2) : null; + public override void _Ready() => AddChild(_skin); /// Where the puppet draws body now (world), or null if it draws no such body.