Click to See Complete Forum and Search --> : Pointing an object (surface) towards the camera.
Sastraxi
Mar 11th, 2001, 08:37 AM
I would like an algorithm to "point" a surface of an object toward the camera. I know the position of the camera, and I know the centerpoint of the surface. Would anyone here know how to accomplish this?
HarryW
Mar 11th, 2001, 08:59 AM
I think you need to find a normal to the plane of the surface. You can find one using the cross product of two vectors in the plane, or probably some other way. My 3D geometry is something I'm working on.
You'll probably need to find a unit vector, normal to the plane and point that at the camera's vertex. If you have local coordinates and world coordinates for the object you should just have to change the world coordinates.... I think.
Sastraxi
Mar 11th, 2001, 09:09 AM
Hehe... the funny thing is, I seem to know less than you :)
I know what a normal is, but I thought that they were only used to make a smooth surface! Also, I don't know how to get the 'cross product' of two of the vectors.
And in the second paragraph, you told me just to point the vector at the other vector! I already know these vectors, and that was my question, how to I point it at the camera.
Anyways, I posted in the maths forum and came up with a response, said he'd come up with the code if I had more details...
Thanks anyway, HarryW.
Sastraxi
Mar 11th, 2001, 09:35 AM
Hey guys!!!
This is pretty darn cool, eh?
Actually, the effect is better when you have longer text!
Well, that's about it, I just downloaded this tool and it makes everything look pretty cool!
Sastraxi
Mar 11th, 2001, 09:49 AM
Never mind me, I just downloaded this cool tool for VB-World posts. It makes everything look spiffy, so to speak...
HarryW
Mar 11th, 2001, 10:14 AM
Heh, very nice ;)
I noticed that Sam had picked up the topic, and I really have no hope of coming up with anything he wouldn't come up with (Sam is the local maths guru after all), so I think I'll let him come up with the answers and just watch and learn :)
There is a pretty good geometry tutorial at flipCode (http://www.flipcode.com/geometry/) if you're interested.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.