| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
| Need some help creating flight in an airplane game; Using vectors for realistic flight | |
|---|---|
| Tweet Topic Started: Aug 5 2010, 12:30 PM (373 Views) | |
| Harry | Aug 5 2010, 12:30 PM Post #1 |
|
Newbie
![]() ![]() ![]()
|
Hi everyone, Iam currently creating an online fighter airplane game simmilair to ace combat. However I have ran into a problem. I have absoloutley no Idea how to create realistic flight. I have done a search and found only one topic dating back to 2005, before U3D had the math functions. I have also done a search on the GMC and found a little tutorial on flight. However, it was written for the D3D functions and uses GML for the maths. I tried implementing into my game with no luck. However even if it did work it would be to slow. When I pressed two buttons at once the fps fell from 500 to 300! Iam assuming U3D would be alot faster. Basically what happens at the moment is that when I press 'S' the rotx is decreased and the airplane goes upwards. However, obviously, when I press 'A' or 'D' and rotate the rotz of the plane, next time I press 'S' or 'W' the plane goes up or down. However it goes up or down as it did before. Completely ignoring the rotation of the airplane. I need the airplane to go up or down relative to the airplanes rotation, not relative to ground. I hope you understand what I mean. I think what I need todo (after reading the D3D tutorial) is to create three vectors. One for x, one for y and one for z. I then need the vectors to rotate with the airplane and then somehow base the rotation or the movement of the airplane on the vectors? I find it all really confusing. I have ready the manual twice but I still don't even know how to use vectors (or matrices/matrix's?, I think you have to use both?). Hopefully this should be fairly easy for someone who knows about these things to tell me how to do it. In the topic dating back to 2005 I believe Dr. Best said that if there where Math functions in U3D it would be very easy to do. Instead he wrote an entire script in GML to make it work. By the way I did try that script a few months ago but couldn't get that to work either.. By the way here is a screenshot of my game so far. It is about 90% complete now. The online is now complete so there isnt much left todo. All I need todo is make it so that people can shoot eachother down, add some sort of unique gameplay to it (Just shooting eachother down could get boring after a while) and make the flying realistic! Now I have finished colledge Iam working on it 10-12 hours a day so it will be finished next week, I will upload it once I have created a website.
|
![]() |
|
| Eansis | Aug 5 2010, 04:05 PM Post #2 |
|
ghost
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
EDIT: Crap the download expired...anyone have this on their computer? made an example: There is only one bug, You can use a joystick, but if you unplug it you will get lag. So make sure you really want to use a joystick because you cannot unplug it (without restarting your computer.) http://filebeam.com/0be5711312d2ac17e809a755d32d3ff9 It is not 100% realistic but it should be good enough to start. Helpful Description of keys and meanings -AGL > How high the plane is. If this is at 1 or 0 that means you're still on the ground. -THR > Throttle (In %. AB = Afterburn, > 100%.) -AOA > Angle of Attack (Currently displays incorrect values). -VEL > Airspeed (In knots). -SB > Speedbrake (Slows aircraft down). Keypress "B". -WB > Wheelbrake (Slows aircraft down, only when on ground). More effective than Speedbrake. Keypress "W". -Rudder > Yaws aircraft left and right. Keypress "Z" and "C". Joystick buttons "3" and "4". -Elevator > Pitches aircraft up and down. Keypress "Up arrow and Down arrow". Joystick Axis 1. -Ailerons > Rolls aircraft left and right. Keypress "Left arrow" and "Right arrow". Joystick Axis 1. Edited by Eansis, Aug 5 2010, 04:07 PM.
|
VOTE FOR BUDDY ROEMER HE'S A STRAIGHTFORWARD, DOWN TO EARTH AMERICAN GUY WHO ISN'T PART OF THE BIGBROTHER CONSPIRACY
| |
![]() |
|
| Sothh | Aug 5 2010, 07:41 PM Post #3 |
|
Shaman Of Time
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Since MisteriXYZ is not here I will have to answer... What you need is matrix'es! Heres what you need:
Thats the step event of an old flight simulator I made. Simply set the Thrust var and your ready to go. You won't need that much code, but I included my physics. |
|
“You can’t outrun Death forever. But you can make the Bastard work for it.” Major Korgo Korgar “Last of The Lancers” - AFC 32 (Andromeda Ascendant Record Database) | |
![]() |
|
| Harry | Aug 6 2010, 08:56 PM Post #4 |
|
Newbie
![]() ![]() ![]()
|
Thanks it works great! haha also I now have it so that it speeds up going downhill and slows down going up! well, thats the hard stuff done now (online and flight eninge), Iam now set and ready for a finishing date of wednesday
|
![]() |
|
| Sothh | Aug 8 2010, 07:49 PM Post #5 |
|
Shaman Of Time
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Thanks! And remember to give credit where credit is due. I can't wait to see it! If you have any more questions feel free to pm me. By the way, as you should see you can enable joystick and mouse control as well. You might want to add a option in the game to do this. |
|
“You can’t outrun Death forever. But you can make the Bastard work for it.” Major Korgo Korgar “Last of The Lancers” - AFC 32 (Andromeda Ascendant Record Database) | |
![]() |
|
| mardyart | Sep 19 2012, 06:53 AM Post #6 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
How could I modify this to work on a planet model where it rotates at a constant rate around the roty(yaw) axis but has a fixed tilt of 23.5 deg on the rotx(pitch) axis. Any help would be appreciated. |
| There are 10 kinds of people in the world: Those who understand binary and those who don't. | |
![]() |
|
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |





![]](http://z1.ifrm.com/static/1/pip_r.png)




haha also I now have it so that it speeds up going downhill and slows down going up! well, thats the hard stuff done now (online and flight eninge), Iam now set and ready for a finishing date of wednesday
2:22 AM Jul 11