|
-
Mar 11th, 2001, 09:36 AM
#1
Thread Starter
Good Ol' Platypus
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?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2001, 09:57 AM
#2
Frenzied Member
I know the maths behind it and should be able to come up with an algorithm, but I'd need to know more about how you're storing your surface. And other parts of your object.
If it wasn't for this sentence I wouldn't have a signature at all.
-
Mar 11th, 2001, 10:06 AM
#3
Thread Starter
Good Ol' Platypus
It's just a simple quad in OGL that has two sides, mapped with a texture. It's located in variables stars(i).x,stars(i).y,stars(i).z, and the camera is cam.x, cam.y, cam.z. After translation, the points are
-1.0,-1.0, 0.0
-1.0, 1.0, 0.0
1.0, 1.0, 0.0
1.0,-1.0, 0.0
If you use OGL you will know what I mean. It means that the center point of translation is now 0. This makes it easy to make coordinate systems for each polygon.
There are two surfaces, and obviously I would just do a Y rotation of 180 degrees to get the opposite side. I am running a particle engine and the stars must be visible at all times.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2001, 11:33 AM
#4
Thread Starter
Good Ol' Platypus
Unfortunately I cannot understand it, HarryW. I need VB CODE to do this, PLEASE! Don't refer me to a website, I will get confused. I need CODE!!!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 11th, 2001, 12:02 PM
#5
Frenzied Member
Hey, that was just a geometry tutorial, I already said I'll let Sam handle this since I don't understand it too well. The geometry tutorial was something you might want to look at if you want to learn some more geometry.
Harry.
"From one thing, know ten thousand things."
-
Mar 11th, 2001, 12:48 PM
#6
Frenzied Member
I'm afraid I've never used OGL so that doesn't help much.
Can you get the coordinates of 2 other points on the surface
? I could do it off that. You'll also need the coords of the point you wish to rotate the object about. (If you want to rotate about the centre of the surface then it's much easier, so tell me if that's what you want to do)
I'll have to refresh my memory on the maths first but I'll put the algo up when I work it out.
If it wasn't for this sentence I wouldn't have a signature at all.
-
Mar 11th, 2001, 02:07 PM
#7
Frenzied Member
-
Mar 11th, 2001, 02:23 PM
#8
transcendental analytic
you could get the cross product of 2 offsetvectors of the surface, divide it by it's length and multiply with distance to camera.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 11th, 2001, 02:32 PM
#9
Thread Starter
Good Ol' Platypus
mebbe some code would be more helpful..
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|