I'm merrily drafting some functions to allow my 3D game to have wingmen.
So far, so good. However, I thought I'd seek the wisdom of the people here as to one issue that has cropped up.
One of the functions I've been writing makes a wingman fly up and form on the wing of a nominated object, i.e. after a battle has finished, after leaving a mother ship, etc. What I am curious about is whether there is any command in DBPro that returns the direction the object is pointing? I've looked at writing a custom function with the object angle x, y, z commands but I haven't had any brainwaves.
Obviously an easy way to achieve my goal of getting the wingman to fly up to the wing position would be to return the x, y and z positions of the wingman's destination, then point object to those coordinates then and then move object, i.e.
Rem This is conceptual code - it is not intended to work.
Rem Assume the wingleader is object 1 and the wingman is object 2
posx# = object position x(1)
posy# = object position y(1)
posz# = object position z(1)
Rem Offset the position to give the wingman's destination on the wing
Point Object 2, (posx# + 260), posy#, (posz# - 150)
Rem Move the ship to its destination
do
pos2x# = object position x(2)
pos2y# = object position y(2)
pos2z# = object position z(2)
repeat
move object 2, 1
until (((posx# + 260) = pos2x#) AND (posy# = pos2y#) AND ((posz# - 150) = pos2z#)))
loop
This seems like cheating to me though.
I'd much rather write a function based on returning the direction the wingman is pointing, and then fly it to the destination from there via some trig and vectors, etc.
I'm wondering if anyone has any views on this?
Phil
What do you mean, bears aren't supposed to wear hats and a tie?