Code archives/3D Graphics - Maths/Lib to create an OBB and test if a point or entity is inside its space

This code has been declared by its author to be Public Domain code.

Download source code

Lib to create an OBB and test if a point or entity is inside its space by Zethrax2007
This lib allows you to create and configure an Oriented Bounding Box (a box that is not locked to the dimensional axiis), and then test if a point or an entity has intruded into the OBB's space.

; The code can be found at: http://www.blitzbasic.com/codearcs/codearcs.php?code=1920

Comments

Stevie G2007
Not bad

For info, this will only work for scaled entities rather than scaled meshes. You'd need to use mesh depth, height and width instead of default 1.0 for a more robust check.

Note that from what you have it's also easy to get the penetration depth and collision normal of a point in rect by using the axis of least separation theory.

You could also do the axis checking by just using .. "If abs(x#) <=1.0" etc..

Stevie


Code Archives Forum