# actor airplane

trying to set up a airplane actor, sort of know how to taking off the ground and fly forward, but the moment you release the keyboard, the airplane droped on the ground, how to keep the airplane sort of floating above the ground?

turn down the gravity in the world buttons

would this change everything within the level? Or it only applys to the selected object?

Why don’t you actually try someone’s advice instead of guessing what it would do?

No, making gravity 0 would affect everything. There is not really a good way to stop the plane from going back to the ground, but you could kinda fake it by adding a positive Z force that isn’t linear always that counter-acts the gravity (uncheck the L button next to the force values in the motion actuator). This would work alright, but tnot that great.

Why don’t you try to use an helicopter ?
I think the fly model is a little less difficult…

If you use force forward, which is like the engines of an airplane, you could just aim the nose of the plane up and it would go up. If the plane isnt going fast enough, then it wont counteract gravity, but if you go fast enough then it will. If you use python, you can have a key that sets the force the airplane should go, then scales the actual force up. Without python though, you could do it simpler.

Add an int property to your airplane called “speed”. Add another int property called “currentspeed”. Finally, add a timer prop called “timer”.

Forces:
Now add some sensors. Depending on how many speeds you want, that’s how many sensors to add. Each one will be a prop sensor that looks for the prop “curspeed”, "equals
some value. If you want 3 speeds, you have one that says: “curspeed” equals 1, one that says “curspeed” equals 2, and one that says “curspeed” equals 3.

Connect each curspeed sensor to its own controller, and finally to its own motion sensor. The motion sensor should be a force forward, of increasing amounts. Curspeed equals 1 could have a force of 10, curspeed of 2 could have a force equal to 20, etc. When the logic is set up, you will have to tweak these values.

Speed Setting:
Now we will add the logic for the user to set the speed. The easiest way is to do it like most flight simulators - number keys set your speed. Add a key sensor for each speed. 1 for speed 1, 2 for speed 2, 3 for speed 3. Connect each to its own AND controller, and finally to its own prop sensor. The prop sensor should set speed equal to the appropriate value.

Controlling actual speed:
Now we have to control what the speed of the plane is actually at. We do this with a timer. Every time the speed changes, we reset the timer, and then each time the timer is above a set value, we move the currentspeed one value closer to the speed the user chose. Add a prop sensor, type “changed” prop “speed”. Connect it to an and controller, and to a prop actuator that sets timer to 0. This will reset the timer every time we set a new speed.

Add three new prop sensors, we’ll call them A, B, and C. “A” should be an interval of prop “timer” set the min to some value. If you want it to take a second for the speed to change, set the min to zero. 0.5 seems like it would be good to me. Set the max one higher than the min.

“B” should be an interval of prop “curspeed”. Set the min to 0 and the max to “speed”. This will check if we are currently going slower than we want to be.

“C” should be an interval of prop “curspeed”. Set the min to “speed”, and the max to whatver the max speed is (In this example I chose 3). This will check if we are going faster than we want to be.

Make two AND controllers. One will make us go faster, one will make us go slower. Connect sensors A and B to one of these, and A and C to the other. I henceforth proclaim these controllers to be called AB and AC.

Make 2 actuators. One to increase speed, and one to decrease speed. We will also use the actuator we made before that sets timer to 0. Connect both controller AB, and controller AC, to the actuator that resets the timer (prop, timer, equals 0). On one of the new actuators, make it type property, put “curspeed” in the box, set it to “add”, and put 1 for the value. On the second actuator, make it type property, put “curspeed” in the box, set it to “add”, and put -1 for the value. Connect AB to the +1 actuator, and AC to the -1 actuator.

Now test it out. There are several areas that require tweaking, as I haven’t made this before I just came up with it on the spot. You can tweak the motion actuators, as well as sensor “A”. If it takes to long to speed up, make the min value of sensor “A” smaller. If it’s too fast, make the min value smaller. If the actual speed of the plane isnt right, adjust the force values of the actuators. Also make sure the forces are on the correct axis

Thank you so much for the informations. Will try!