From 8be057a4b120d05453c779b26ec079e102433604 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 01:03:03 +0100 Subject: [PATCH] SoA add_body publishes only the size components its kind uses Soul low finding on cut-ymir-shape-lanes.s1: a direct native caller could publish nonzero unused components, contradicting the docs. Co-Authored-By: Claude Opus 5.5 --- native/Ymir.Box3D/ymir_box3d_soa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/Ymir.Box3D/ymir_box3d_soa.c b/native/Ymir.Box3D/ymir_box3d_soa.c index 6cfbba1..088195a 100644 --- a/native/Ymir.Box3D/ymir_box3d_soa.c +++ b/native/Ymir.Box3D/ymir_box3d_soa.c @@ -496,9 +496,11 @@ YMIR_EXPORT int32_t YMIR_CALL ymir_box3d_soa_add_body( world->kind[i] = d->kind; world->parent[i] = d->parent; world->limb[i] = d->limb; + /* Publish only the components the kind uses; unused ones read 0 whatever the caller passed. */ + int used = d->kind == YMIR_SOA_KIND_SPHERE ? 1 : d->kind == YMIR_SOA_KIND_CAPSULE ? 2 : 3; for (int k = 0; k < 3; k++) { - world->size[(size_t)k * (size_t)world->capacity + (size_t)i] = d->size[k]; + world->size[(size_t)k * (size_t)world->capacity + (size_t)i] = k < used ? d->size[k] : 0.0f; } ymir_soa_refresh(world, i); if (index != NULL)