Quadcopter Physics

Hello, I am working on a game with a quad copter and I have 4 forces added to 4 empties that are positioned in the center of each rotor. To move forward, I have the back forces increase. I need to have the craft “reset” or stabilize and stop itself after I release the button. I tried using GetKeyUp and decreasing the back force, but I do not know how to calculate the opposite forces that are needed to stop the craft because the amount of time changes each maneuver. Thanks ahead of time!

btw : I am not sure if I should just use torque for everything movement related.

I recently tried my hand a physics based quadcopter demo and I ran into exactly the same issues you did. I could tilt it forward but it wouldn’t return to its start position. I think you could just do physics for the whole object and it would be easier but I wanted to do everything controlled by just a force on the 4 engines like you have.

The solution I came up with involved a restoring force and a dampening force. To begin with you want a set up that allows you to add up the forces for each engine and then apply it to the engine. Then what you will want to do is calculate a restoring force. This is a force dependent upon the difference in the angle of the quadcopter currently and the level.
So say the copter was tilted forwards (front end down and back end up) by 30 degrees, you would need a force that is proportional to that angle applied in the opposite direction. So in the example where the front end is down and the back is up, you would apply an upwards force to the front end that is proportional to 30 degrees. It would be a larger force depending on how large that angle is.
And that will work to some extent but you will end up with a sort of oscillating motion and a lot of wobbling. So to fix that you need a dampening force. This is a force that is proportional to the rotational velocity. So imagine the front end starts off tilted down, then starts to return to a level position. It will rotate back to this position at a certain velocity. So you will need to apply a force that is proportional to the velocity but in the opposite direction. If the front end is moving upwards, you would counter this by applying that force to the back engine to counteract it.

2614438--183409--QuadcopterPhysics.png
The black bar represents the copter at a side view, the green bits are engines. x is the angle away from level. Blue is the restoring force depending on that angle and red is the dampening force dependent on the rate of the change of that angle.

Sorry if that’s not clear, just reply if you are confused and I’ll do my best to explain. Also if someone else has a much better answer ignore this as there is a good chance I decided to do this the hardest way possible.

1 Like