fix: sphere collider matches visual size — create at radius 0.5
Root cause: CreateSphere(r) baked scale into mesh radius, then Transform applied scale again → double scaling. Visual radius was scale*0.5*scale but collider was scale*0.5. Fix: always create sphere at radius 0.5 (unit sphere, like cube.obj). Scale is applied through Transform only. Collider radius = maxScale*0.5 matches visual radius = 0.5 * scale.
This commit is contained in:
@@ -85,8 +85,7 @@ public sealed class AiCommandProcessor
|
||||
Mesh mesh;
|
||||
if (isSphere)
|
||||
{
|
||||
var r = MathF.Max(MathF.Max(command.Scale.X, command.Scale.Y), command.Scale.Z) * 0.5f;
|
||||
mesh = ProceduralMesh.CreateSphere(r, 24, 12, new Vector3(0.5f, 0.6f, 0.9f));
|
||||
mesh = ProceduralMesh.CreateSphere(0.5f, 24, 12, new Vector3(0.5f, 0.6f, 0.9f));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user