Page 1 of 1

Point intersection test

Posted: Tue Feb 22, 2011 1:21 pm
by steko
Hi Norbo,

is it somehow possible to check whether a point is inside a phyiscs entity?
Here is my current working code. Is there any overhead expect of the out params? Is this solution recommended?

Vector3 hitLocation;
Vector3 hitNormal;
float t;
bool isCameraInsideCone = Toolbox.RayCast(Camera.Position, Vector3.Zero, 1f, PhysicsEntity, PhysicsEntity.CollisionMargin, out hitLocation, out hitNormal, out t)

Thanks,
steko

Re: Point intersection test

Posted: Tue Feb 22, 2011 7:40 pm
by Norbo
MPRToolbox.IsPointInsideEntity is an option. Using a raycast would be generally fine too. The overhead of unused out params is practically nonexistent compared to the cost of the rest of the function.

Re: Point intersection test

Posted: Tue Feb 22, 2011 8:52 pm
by steko
thanks, I didn't noticed the MPRToolbox class. What exactly are the differences between Toolbox and MPRToolbox? Is this MPRToolbox limited to any simulation settings?

Re: Point intersection test

Posted: Tue Feb 22, 2011 9:09 pm
by Norbo
The MPRToolbox is just an intermediate move towards segmenting the giant Toolbox into more organized components. In v0.15.0, the Toolbox gets split a bit more (GJK stuff has its own Toolbox too). Eventually, I'd like to have a clean, implementation-abstracted Toolbox for common tasks, rather than the current giant list of questionable miscellaneous functions.

Since it's just an organization thing, there are no extra limitations with its usage.