# Real Drone Simulation with Hinge Joint?

Hi,

i wanna create a drone Simulator as realistic as possible. Currently i created an octocopter drone where the rotors are connected to the propeller with a hinge joint.

Now i’m using just addForce methodes and up-Vectors, what is easy but not accurate i guess.
Is it possible, to let a drone fly only with hinge joint if i adjust the mechanics of a real drone to unity?

u wot m8

Are you meaning that the spin of the propeller will be the factor creating force?

You should let the propellers rotate with transform.Rotate(Vector3.up * someValue * Time.deltaTime, Space.Self) (in Update!)
or something…making them all rigidbodies itself and adding forces seems to be wrong.
Also hinge joints are not necessary.

What you can do is use AddForceAtPosition for every propeller(position) and increase or decrease the forces there.

Lets say you have your drone (parent) and 8 (empty) children. These are (then moved to) the positions for each propeller. Drag them all into an array

var propeller : Transform[ ] = new Transform[8];
private var propellerInputForces : float[ ] = new float[8]; //later in the code, you add or subtract input
private var propellerRotationMultiplyVariable : float = 30.0; //make propellers spin faster

``````and then, in Fixed Update:
for (var i : int = 0, i < 8, i++) {
}

In Update:
for (var ii : int = 0, ii < 8, ii++) {
propeller[ii].Rotate(Vector3.up * propellerInputForces[ii] * propellerRotationMultiplyVariable * Time.deltaTime, Space.Self);
}
``````
1 Like

How exactly?

For a standard Quadcopter subtraction and addition of forces based on direction and thrust is complex enough.

If you have some sort of system to make this easy to scale for Multicopters of engines over 3 I would be really interested in knowing more about it.

I don’t know anything about drones hehe

But what I mean with input is, that you can set thrust on all propellers seperately.
Controlling all these propellers, that is - of course not part of the (pseudo) code I posted… I think That would be part of your developing process. Again, I am really not into drones.

I could imagine that you could simulate a quadcopter, and make every second propeller just ummmm cosmetic

I’m not really following what you’re asking for but if you want to simulate a “multi-rotor” or “multi-copter” (the use of the term “drone” just irks me ) I’d start by implementing it the same way as real multi-rotor flight controllers do.

• simulate a gyro
• simulate an accelerometer
• implement a Flight Controller that takes the inputs from the gyro and accelerometer. It’s not crazy complex, it’s mostly based on these two inputs and the configured P.I.D values.

It’s a well understood problem that’s been solved.

Thanks at all. I made it similar to this.
So i used the ForceAtPosition.

simple drone simlation in 10 mins