Surely it would be ""if
view.camera.orientation.transform(theVector).z < 0 " since the camera
is located at 0,0,0 in camera coordinates.
I don't think that would work either, but I will give it a try (along
with Jeff's).
The problem that I think I see with your code is that
quaterion.transform is not camera.objectToWorldTransform.
The camera's orientation doesn't know about the camera's position, so
that would just test if theVector was behind the camera if the camera
was at (0, 0, 0).
Soryy, yes I wasn't really paying attention to your code. This will
only work if the camera is located at 0,0,0 in world corrdinates.
What I originally suggested was that you use OpenGL's glProject
function which handles both the rotation and translation. If you wish
to do this using your own engine's methods then you will have to do
this a different way. I think all that is required is to first
translate the object coordinates by subtracting the camera's
coordinates from them, and then perform the rotation (incidentally I
think the rotation needs to be the inverse of the camera's own
orientation also). Basically you just want to do whatever it is you do
to the object to draw it on screen .Conceptually it's very simple - you
want to know if the object is behind the screen therefor you want to
know if its z is negative when converted to screen coordinates.
I don't really know how to make this any clearer, sorry.
Nick
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|