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

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

Calculating Oriented Bounding Boxes (OBB) using Entity Rotation Quaternions

HexRays99
Senior Reverse Engineer
VIP
Rep: 380
Join Date: Apr 2022
Posts: 36
Thanks: 94
4y ago · Jan 1, 2022 8:00 AM
#1
How to transform local AABB min/max bounds into Oriented Bounding Boxes using entity rotation quaternions in 3D space.
HexRays99 · Reverse Engineering & Static Analysis
CPP
// Always check your pointers!
if (!pLocalPlayer) return;
The following users thanked HexRays99 for this post:
NullPtr_
Assembly & Engine Research
MEMBER
Rep: 260
Join Date: May 2023
Posts: 27
Thanks: 62
4y ago · Jan 1, 2022 11:44 AM
#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.
NullPtr_ · 0xDEADBEEF was here
ZeroMemory
Member
MEMBER
Rep: 75
Join Date: Oct 2024
Posts: 32
Thanks: 18
4y ago · Jan 1, 2022 12:44 PM
#3
Projecting the 8 corners with WorldToScreen and connecting 12 edges creates an authentic 3D box that tilts with slopes and stairs.
ZeroMemory · Always experimenting