From 1d60ed6087e53a9a8f8c04d73d0df9811e31da3c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 15:02:24 +0100 Subject: [PATCH] Puppet.Centre: the world centre of the drawn bounds, forwarded by BodyRenderer.PuppetCentre The point the orbit camera turns about. Null before the first draw. Co-Authored-By: Claude Sonnet 5.5 --- client/BodyRenderer.cs | 3 +++ client/Puppet.cs | 3 +++ 2 files changed, 6 insertions(+) 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.