In GREAT need - Qbasic gurus HELP!

Quote:

> I am in the middle of programming my space sim and ran across a few

> probs. they are as follows:

These problems sound more like math/physics question than a programming

question! Hehe...

Quote:

> 1. I need a way of converting normal numbers to degrees, anyone got an

> equation?

Given x, y, z cartesian coordinates with x axis going from left-to-right, y

axis going up-and-down, and z axis going front-to-back, the degree can be

calculated using the following equation:

horizontal.angle.degree = atn(z/x) / 3.1415 * 180

vertical.angle.degree = atn(y / sqr(x^2 + y^2 + z^2)) / 3.1415 * 180

Quote:

> 2. If the UP ARROW brings the ships nose down, the DOWN ARROW brings the

> nose up,

> and the LEFT & RIGHT ARROWS control left and right turning, how would

> you put

> those into a decently short equation that would calculate your X, Y,

> and Z

> position?

That depends.

When an object moves in space, there are several things to take into

account:

1. Which way is it facing? (the horizontal and vertical angles)

2. What fast is it traveling?

3. For which point in time do you want to calculate the position?

Say the ship is facing H angles horizontally and V angles vertically. It

travels at S speed and you want to calculate what position the ship will

occupy in T time. Then the equation becomes the following:

new.x = tan(H) * S * T * cos(H) + old.x

new.z = tan(H) * S * T * sin(H) + old.z

new.y = tan(V) * tan(H) * S * T + old.y

I just derived that using trig functions so cross your fingers! :)

Quote:

> 3. I am still in need of a FAST radar for the game. The enemy ships

> positions ARE

> NOT in relation to the position of the ship, they are placed in set

> coordinates.

> HELP?!?!?!?

That depends on how you wish to display the radar. After all, you *are* in

a three-dimensional space. Whatever the case, though, you would have to go

through each coordinate and check to see if the enemy is there; or you

could assign a coordinate of each enemy and read those coordinates off of

each enemy; you could also update the radar display whenever you update the

enemy's coordinate.

--

Mark K. Kim

http://members.aol.com/vindaci/

http://members.aol.com/markkkim/