Home / Forums / Calculating Oriented Bounding Boxes (OBB) using Entity Rotation Quaternions (Part 2)

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

Calculating Oriented Bounding Boxes (OBB) using Entity Rotation Quaternions (Part 2)

NeighborSpy
Unity & Secret Neighbor Modder
VIP
Rep: 290
Join Date: May 2023
Posts: 17
Thanks: 76
3y ago · Sep 16, 2022 12:52 PM
#1
How to transform local AABB min/max bounds into Oriented Bounding Boxes using entity rotation quaternions in 3D space.
NeighborSpy · Secret Neighbor & Unity Netcode
PlayerRole, Keycards, Basement Locks & Stamina inspection
The following users thanked NeighborSpy for this post:
HexRays99
Senior Reverse Engineer
VIP
Rep: 380
Join Date: Apr 2022
Posts: 36
Thanks: 94
3y ago · Sep 16, 2022 4:16 PM
#2
Quaternions represent 3D rotation without gimbal lock. Multiplying each of the 8 local vertices by the rotation quaternion and adding world origin generates exact 3D corners.
HexRays99 · Reverse Engineering & Static Analysis
CPP
// Always check your pointers!
if (!pLocalPlayer) return;
RenderMaster
ImGui UI Designer
VIP
Rep: 310
Join Date: Sep 2023
Posts: 32
Thanks: 82
3y ago · Sep 17, 2022 5:16 PM
#3
Projecting the 8 corners with WorldToScreen and connecting 12 edges creates an authentic 3D box that tilts with slopes and stairs.
RenderMaster | Clean UI Design & Dear ImGui widgets