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 / 3D Free Flight Rotation - smooth rolling

Author
Message
Echadan
19
Years of Service
User Offline
Joined: 27th Sep 2006
Location:
Posted: 28th Sep 2006 04:53
Can anyone offer some assistance for getting an object (or the camera) to respond to the arrow keys in a way that creates a nice airplane affect. Sure, DarkBasic gives us the turn object/roll object commands but how can you use them to make the object bank in its turns? Just using one or the other (e.g. turn object or roll object) doesn't create and nice effect and doing it like

if leftkey()=1 then turn camera left 1:roll camera left 1

doesn't make a nice effect either. I believe that there needs to be a function of some sort but I can't figure it out. Any thoughts?
The Wilderbeast
20
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 30th Sep 2006 17:09
for the sort of thing you are doing then you would want a plane physics engine to help you. i started off one but haven't done much to it since. bearing in mind that my one is meant to be 'basic' and is still about 240 lines long!

Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 1st Oct 2006 00:06
Try checking out the curveangle() command.

Red Ocktober
22
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 2nd Oct 2006 19:02 Edited at: 2nd Oct 2006 20:45
you're gonna have to write the code to move and rotate and fly the plane object... not really as bad as it sounds...

if you've got a plane model, load it into the app... then first thing, get it to move forward by itself when power is applied (use a variable for power and relate that to a variable representing speed)... move the object by the speed variable... have a key to add and retard power...

then next comes direction... left and right... don't worry about up and down just yet (these'll come later, and make the whole thing much more complicated)...

an airplane's yaw is controlled by the rudder... so add a variable for rudder position, and make that change with key strokes... and have a way to center it... either releasing the keys or whatever...

once you've got that your gonna have to change the orientation of the object based not only on the rudder position, but also it's speed... the faster it goes, the more it turns for a given rudder position... up to a point... and below a certain speed, no there is no turning effect, no matter how much rudder you put in...

the code you will have to figure out... just take one thing at a time...

after this is working, then attack the up down stuff in the same way... only with this you'll have to factor in gravity... something called stall... and probably one or two more things i've forgotten...

depending on how realistic you want your plane to fly, there's a few things that'll have to be coded in... just get the basics done first, whithout making it too compicated...

i'll try to monitor the post and help you out a bit if i can...

good luck...

**added**

i think it's cool that someone is starting a project like this in DBClassic at this date...

--Mike
Echadan
19
Years of Service
User Offline
Joined: 27th Sep 2006
Location:
Posted: 2nd Oct 2006 19:35
Thanks for your help, I'll give it a try.
Echadan
19
Years of Service
User Offline
Joined: 27th Sep 2006
Location:
Posted: 2nd Oct 2006 19:36
Thanks for the help, I'll give it a try.

Login to post a reply

Server time is: 2026-07-06 10:33:20
Your offset time is: 2026-07-06 10:33:20