Lately I've been trying to make a 3d program (with Qb) i started out by trying to make a 3d starfield (like the screensaver), I've got most of it down, but i can't seem to get the math for placing a star right... I can get the direction, but not the distance away from the center...

Here's the placement code:

VB Code:
  1. Far = ABS(Dir1)+ABS(Dir2) / 2
  2. 'Far is how far from the center
  3. 'Dir1 is the angle from you to the star (X and Z axis)
  4. 'Dir2 is the angle from you to the star (Y and Z axis)
  5. 'Dir3 is the angle from you to the star (X and Y axis)
  6.  
  7. X = 320 + (((ABS(Far)*SIN(Rad(Dir3))) / 180) * 640)
  8. Y = 210 + (((ABS(Far)*COS(Rad(Dir3))) / 180) * 420)
  9. 'Rad is a function that converts degrees to radians
  10. 'X is x position, and Y is y position
  11. '320+ and 210+ put the startign point in mid of screen
  12. '/180)*640 and /180)*420 stretch the circle out so it coveres the screen

The problem is with the first line of course, i used the angles... the actual moving forward looks pretty real, but if i tell it to move to the side... well the stars seem to go in a circle

Any ideas?