GarageGames / Torque3D

MIT Licensed Open Source version of Torque 3D from GarageGames
http://torque3d.org
MIT License
3.35k stars 1.2k forks source link

castRay() from inside geometry has different behaviors #389

Open lornemcintosh opened 11 years ago

lornemcintosh commented 11 years ago

I've been relying (for better or worse) on the fact that SceneContainer::castRay() used to return true, and set rayInfo.t = 0 (as if it hit something immediately) when ray-casting from inside a .dif interior to some point outside.

In T3D 3.0 interiors are history, and I've noticed that castRay() has totally different behavior for TSStatics. It returns differently based on the TSStatic collisionType:

Terrain has yet a third behavior. castRay() returns true and sets rayInfo.t as if the ray collided with the backside of the terrain on its way out (ex. 0.6189).

So... which should it be? Can we get consistent behavior across all types? What's the correct way to test a point for inside / outside collision geometry?

crabmusket commented 11 years ago

I vote for replicating the Interior behavior on shapes but leaving the Terrain behavior as-is. Consider that some buildings may deliberately protrude below the terrain, so counting any raycast below the terrain as an immediate collision would be counterproductive.

crabmusket commented 10 years ago

Since this involves changing the API for some methods, let's leave this for 4.0.