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:
Far = ABS(Dir1)+ABS(Dir2) / 2 'Far is how far from the center 'Dir1 is the angle from you to the star (X and Z axis) 'Dir2 is the angle from you to the star (Y and Z axis) 'Dir3 is the angle from you to the star (X and Y axis) X = 320 + (((ABS(Far)*SIN(Rad(Dir3))) / 180) * 640) Y = 210 + (((ABS(Far)*COS(Rad(Dir3))) / 180) * 420) 'Rad is a function that converts degrees to radians 'X is x position, and Y is y position '320+ and 210+ put the startign point in mid of screen '/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?




Reply With Quote