maybe it's easy enough to do yourself :)

if you transform your object vertices into cube local coordinates, you
can run six simple checks like x < W/2, x > -W/2, etc on all of them,
and collect max necessary displacements. then transform back into
object parent coords, and there you have it.

in pseudocode that might be smth like:

1) coords_local_to_cube = your_obj_vertex * obj.sceneTransform *
cube.inverseSceneTransform
2) dx = 0; for every coords_local_to_cube, dx = Math.min (dx, W/2 -
coords_local_to_cube.x), same for dy, dz
3) if dx == 0 for every coords_local_to_cube, dx = Math.max (dx,
coords_local_to_cube.x - W/2), same for dy, dz
4) vector = (dx, dy, dz), vector_in_obj_parent = vector *
cube.sceneTransform * obj_parent.inverseSceneTransform
5) obj.coords += vector

On Wed, Dec 3, 2008 at 7:14 AM, cellis <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am trying to do some collision detection in a cube.What is the best
> way to ensure that my object does not go out of the cube? The
> CollisionMap example seemed to need a bitmap but i want the cube to be
> invisible (or not have a bitmap). Any ideas?
>
> Thanks!

Reply via email to