I am trying to make a basic simulation for a drone/quadcopter, with control of each thruster on the drone. The drone itself is a body, with 4 thrusters attached. I am currently working on adjusting the position and rotation of the body based on the position of the thrusters. While I can get the vector from the body center to each thruster, I am having trouble calculating the rotation I should be applying to the body from this. I assume I would use the headings in some way. I have already implemented a way of calculating the position of the body relative to the thrusters, although I haven’t constrained the thrusters to the body yet so they go all over the place.
If you want to check out the code here is a link: P5js Editor
I am still working on this so the code might change here and there, so you might want to make your own copy.
I know the code has a lot of issues as well, and am open to suggestions.