Point of Collision?

__bf_ddc__

14-06-2006 23:47:35

This might be wishful thinking...
But I have a scene that has raycast collision currently working properly... but when selecting an object I pop up some GUI elements and depending on where the mouse clicks to cast the raycast, the GUI popping up could perhaps cover up this selected object from the get-go... so I was thinking it'd be nice to rotate the camera to the point of collision contact, so the object would at least be in the middle of the screen when the GUI pops up.
If I can figure out the point in 3D space where this first collision takes place, then I can create a quaternion to rotate the camera to.
Is it possible to get this point of collision?
Thanks.

__bf_ddc__

14-06-2006 23:58:29

Sorry, I'm a 'tard...
Was looking at some wrong source :)
raycast->mHitPos would find this.
Please forgive me :D

__bf_ddc__

15-06-2006 08:25:20

Okay, I guess I do have a question on this; I get a Vertex3 of the point of collision, but could someone perhaps point me in the right direction to entering this Vector into a quaternion to rotate the camera to... I currently have a quaternion->rotate set up for camera mouse movement, and it updates by an over-time kind of buffer. I wish to create a certain look-at effect when selecting an object in my scene, and rotating the camera to this position; but instead of just popping it into that place, I want to keep my rotate effect. I know the code to update per frame to the destination quaternion is correct, but it seems creating a destination quaternion from this Vector3 point of collision isn't communicating well with things.
Here's the code:
mMouseMat.FromEulerAnglesYXZ(Radian(hitPos.x), Radian(hitPos.y), Radian(hitPos.z));
mMouseQuat = Quaternion(mMouseMat);
mOrientSrc = mCamera->getOrientation();
mOrientDest = mOrientSrc * mMouseQuat;