Game Development Community

Testing if a position is inside a box / trigger

by Bryce · in Torque Game Engine · 11/15/2009 (1:00 pm) · 4 replies

Hello!

Knowing that this will involve a lot of 3d math, does someone here know how to test if a position is within a certain box? I have a position, and I want to test if it's within a certain trigger. Is there a way to figure out if a position is within its world box? Or better yet, is there some kind of convenient isPositionInsideTrigger() function?

Help is appreciated!

#1
11/15/2009 (1:30 pm)
Why not just temp spawn a marker at that position and check if the marker is inside the trigger using the trigger's function - or make a script so that when you spawn your marker, it forces teh trigger to do a quick check and returns true/false depending on if it finds said marker?

In otherwise - spawn marker, do container search from object, if marker is inside %win else %fail.

3D math (which I've just baffled myself with on my own stuff) cunningly averted.
#2
11/15/2009 (1:53 pm)
Not quite. The trigger seems to only be detecting players, not the markers I drop in.
#3
11/15/2009 (2:07 pm)
Box3F Class should help with
bool isContained(const Point3D& in_rContained) const;
bool isOverlapped(const Box3D& in_rOverlap) const;
bool collideLine(const Point3F& start, const Point3F& end) const;

#4
11/15/2009 (2:11 pm)
Thanks Thomas, I'll try making a consoleMethod for isContained()