Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Flight Paths

Author
Message
ScottyB
17
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 18th Aug 2007 23:09
Does anyone know how I would go about
programming flight paths for my 3d objects?

The only idea I have is converting 2d trajectories into 3d and
haveing them follow that.

Is there a simpler way? or better way?
I do not know much about 3d trajectories is that what I need?
And if so could you explain it to me in layman's terms.

Please help if you can.
Thanks
Scotty B.
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 19th Aug 2007 00:43
are you talking about taking off or a pre programmed flight path?

(Y=M*X+B)=(X=(Y-B)/M)=(B=Y-M*X)=(M=Y-B/X)
and if you can figure out what it means i will give you a cookie.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Aug 2007 03:02
you could store a series of waypoints in an array like this

I know nothing about trajectory but when you have your coordinates you can store them like this.

Your signature has been erased by a mod because it was rubbish.
ScottyB
17
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 19th Aug 2007 16:18
I'm taling about a pre-programmed fight path that objects can follow.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Aug 2007 17:25
yes, you program it into the array

Your signature has been erased by a mod because it was rubbish.
ScottyB
17
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 19th Aug 2007 18:10
I get programming the data into an array
but just how do I come up with the points
along a 3d fight path for objects to follow.
Like if I wanted a spaceship to fly around in 3d following
a pre-calculated trajectory?
Pixelator
17
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 19th Aug 2007 19:30 Edited at: 19th Aug 2007 19:32
Make an array that stores waypoints like so:


Waypoints(x,y):array for waypoints
_________^ ^
_________| |
_________| |
insert x and y size here
for/next loop : reads data into array so that whatever you have ate the 1,1 position in you data statements, whill be at the 1,1 position in your array.

Data statements: Has 0 for no array, and 1 - 12 for waypoints folowed in cronalogical order. You can change this to fit your needs whatever they need be.

Hope that helps

(Y=M*X+B)=(X=(Y-B)/M)=(B=Y-M*X)=(M=Y-B/X)
and if you can figure out what it means i will give you a cookie.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Aug 2007 19:46
Check out this link:

http://forum.thegamecreators.com/?m=forum_view&t=107020&b=10

Also, in the DBC challenges, there is a waypoint matrix demo from a month or two ago.

Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Aug 2007 03:15
you could use sine of cosine, if you want a curve.
I don't understand what you mean? A pre-programmed flight path.

Your signature has been erased by a mod because it was rubbish.
ScottyB
17
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 20th Aug 2007 03:53
Interesting ideas maties.

What I get from it is
I can store my 3d points into an array
and then point to those points and move object until
it reaches that point and then point it to next point and move
it there and so on...
That'll work but choppy.
How do I smooth out the transition?
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 20th Aug 2007 08:11
Bezier curves would give a smooth flight path but with less flexibility.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Aug 2007 12:05
@ScottyB
You could use the next two waypoints in your calculations, then it would be a smoother curve.
Or you could pre-program the curve between two points.

@Luke810
Isn't what we were talking about like a beizer curve? or is that something different?

Your signature has been erased by a mod because it was rubbish.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 20th Aug 2007 17:51
B - E accent aigu - ZIER is the correct spelling. A cubic bezier curve works from four control points P1(x,y),P2(x,y),
P3(x,y),P4(x,y)

They are defined by the parametric equations

x = x1(1-t)^3 + (3*x2)(t)(1 - t)^2 + (3*x3)(t^2)(1 - t) + (t^3*x4)
y = y1(1-t)^3 + (3*y2)(t)(1 - t)^2 + (3*y3)(t^2)(1 - t) + (t^3*y4)

Where t is between 0 and 1. The curve begins at p1 and ends at P2 and during the rest of the time curves by each waypoint in the path.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Aug 2007 19:15 Edited at: 20th Aug 2007 19:20
I found a nice little Java applet of Bézier's curve. Thanks for the proper spelling Luke (hold ALT GR and press E for the accent)
Click in the blank area above the body text.

here is the formula they have
Quote: "P(t) = (1-t)^3P0 + 3(1-t)^2tP1 + 3(1-t)t^2P2 + t^3P3 with t running from 0 to 1."


Your signature has been erased by a mod because it was rubbish.
ScottyB
17
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 20th Aug 2007 19:25 Edited at: 20th Aug 2007 19:48
So would z be?

z = z1(1-t)^3 + (3*z2)(t)(1 - t)^2 + (3*z3)(t^2)(1 - t) + (t^3*z4)

What about this?

3-d spherical lissajous curve

x = r sin(Ot) cos(ot)
z = r cos(Ot)
y = r sin(Ot) sin(ot)

is
r = radius
t = time incremnent? skip rate? like 2 4 6 if by 2?
What's difference between big O and little o? angles?

but I never got formula to work to see what it produces.
Any ideas? Help? insight?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Aug 2007 19:37
Quote: "Also it's 3d points not 2d."

Just add an extra line for Z to Luke's Bézier formula.

Quote: "What's difference between big O and little o?"

In DB they are recognised as the same variable so nothing
I'm no mathematician but I think this method would make for wide curves. Is the radius between the two points?
I don't really understand the time increment part could someone explain this please.

Could everyone please put * signs between numbers for multiplication, as this is the way DB works.

Your signature has been erased by a mod because it was rubbish.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 21st Aug 2007 01:16
Obese:
Its a parametric equation, as t goes from zero to one, the results of the two equations give the x and y coordinate of each point on the curve. You can probably read more about it if you search google.

Quote: "So would z be?

z = z1(1-t)^3 + (3*z2)(t)(1 - t)^2 + (3*z3)(t^2)(1 - t) + (t^3*z4)"


I've never used 3d bezier curves before but I think that that would be correct. You have to change the equation for more complex bezier curves, but it follow the same basic principles as you add more points.

Quote: "3-d spherical lissajous curve

x = r sin(Ot) cos(ot)
z = r cos(Ot)
y = r sin(Ot) sin(ot)"


This looks like it might be easier to graph using a polar equation instead of a cartesian one, but that wouldn't be easy in DarkBASIC
ScottyB
17
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 21st Aug 2007 02:25
This shows 3d beziers.

http://www.gamedev.net/reference/articles/article1808.asp

By useing waypoints and control points
we theorically could plot flight paths
for flying ships in space game Hydroxen 9!

Thanks for all the help guys
time to do some hacking!
Peace out!
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 16:21
Thanks scotty, this looks very helpful.

Your signature has been erased by a mod because it was rubbish.

Login to post a reply

Server time is: 2025-05-30 14:02:29
Your offset time is: 2025-05-30 14:02:29