BoxColliderComponent struct in Thread
Axis-aligned box collision shape, centred on the entity origin. Wireframe is rendered in the viewport when the entity is selected.
Properties
| HalfExtents | Thread::Vec3 | Half-size on each axis, in the entity's own space: the entity's Scale multiplies it, exactly as the green box in the viewport shows. A cube scaled to a 50 × 0.2 × 50 floor with the default 0.5 has a 50 × 0.2 × 50 collider. Default {0.5, 0.5, 0.5}. |
Note: Jolt's
BoxShape has a built-in
convex radius of 0.05 m, so a half-extent that comes out below it (after scaling) is raised to
0.05 m.Example
auto& rb = e.AddComponent<Thread::RigidBodyComponent>();
rb.Mass = 10.0f;
e.AddComponent<Thread::BoxColliderComponent>().HalfExtents = { 1.0f, 0.5f, 1.0f };
BoxColliderComponent struct w Thread
Prostopadłościenny kształt kolizji wyrównany do osi, wyśrodkowany w początku encji. Gdy encja jest zaznaczona, w viewporcie rysuje się jego siatka.
Właściwości
| HalfExtents | Thread::Vec3 | Połowa rozmiaru w każdej osi, w przestrzeni samej encji: Scale encji ją mnoży, dokładnie tak, jak pokazuje zielony box w viewporcie. Kostka przeskalowana do podłogi 50 × 0,2 × 50 z domyślnym 0,5 ma kolider 50 × 0,2 × 50. Domyślnie {0.5, 0.5, 0.5}. |
Uwaga:
BoxShape w Jolt ma wbudowany promień
wypukłości 0,05 m, więc połowa wymiaru, która po skalowaniu wychodzi mniejsza, jest podnoszona do
0,05 m.Przykład
auto& rb = e.AddComponent<Thread::RigidBodyComponent>();
rb.Mass = 10.0f;
e.AddComponent<Thread::BoxColliderComponent>().HalfExtents = { 1.0f, 0.5f, 1.0f };