- Home /
Airplane Physics: One or multiple rigidbodys?
Hi there,
I'm wondering about adding more than one rigidbody to my airlane's physic environment. Of course I added at least a 'base' rigidbody to my plane. My approach would be to simulate wings with a AddForceAtPosition() call on the base rigidbody.
But I am wondering about adding one additional rigidbody per wing as child to the plane. So I can simply use AddForce() to simulate the upward force of a wing. The other effect would be a different drag value for the wings than for the plane body to simulate air resistance.
I want to make the physics as realistic as possible. And the user should be able to customize a plane. F.ex. add additional weight to the front or bottom of the plane to edit the center of mass so it fly's better (or even worse if he makes it wrong).
The goal is that the player 'makes' his own plane so he can move the wings, add weight, add an engine, ...
And that's why I thought of adding rigidbody's to all of the components the player can add. Or should I calculate every single component he could at and add all the force to the single plane rigidbody.
Id like to simulate a wrong center of mass, that means if the player adds his wings at the very front of the plane and maybe some weight to the back, it should make some sort of backflip after takeoff (if it takes off...)
I hope you'd get the point.
Thanks for any answer!
Rob
Answer by Fattie · Sep 25, 2012 at 02:02 PM
No as a rule it's just one rigidbody for the whole aircraft. But I've got good news...do you want the good news or the other good news??
the secret you are looking for is ........add force AT POSITION ...
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForceAtPosition.html
regarding the COM ... more good news, you can set it !
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-centerOfMass.html
PS just a thought. If you'd looked at the rigidbody doco page, you would have seen all this great stuff and saved yourself a few minutes. Enjoy
PPS don't forget too you can torque the body other than applying offset forces. that may be better for you
PPPS if you're a badass and did high school math you can set the moment of momentum. Naturally, for normal use the game engine sets the moment itself, in an undocumented but "obvious" way based on the shapes of the colliders, (presumably it assumes the density of the material is uniform.)
PPPPS conceivably, you could get in to attaching your wings with spring joints. they are awesome, but fiddly. i really don't see it as your answer though.
Thanks for this answer. I did read the rigidbody page and I know the AddForceAtPosition() method and centerOf$$anonymous$$ass property. But...
Im searching for the 'best practise' to do a dynamic aircraft. Is totaly impossible to add multiple ridigbodys to one object e.g. an aircraft? Or is it just a huge physics overhead?
It would be much easier for my to make the plane customizable of I could add multiple rigidbodys. I guess the center of mass would calculate itself if I do so. Im not at home so I can't do any prototyping...
The other approach to calculate the centerOf$$anonymous$$ass would be an array of all attached components (engines, wings, weight, ...) to go through and calculate it, right?
I did some prototyping yesterday using the AddForceAtPosition() method. The first problem I faced was that there is no possibility to use local force directions, so I have to translate my desired local force to a world direction force. I had a couple of problems with that.. but I'll try this again today. Well I guess this would be another topic.
At the end of the day, I'll probably just attach one rigidbody to my plane and calculate all force impacts and the centerOf$$anonymous$$ass?
Thanks!
Sorry, this is my first Question here, didn't know about the comments.
Yes well I'd get the thing about rigidbodys and collider wrong, thanks for that!
So just to get this right, I got my Rigidbody on my plane and every additional part (f.ex. the wings, engine, ...) host collider components for the physics engine to calculate.
But. What if I want the wing to have a different mass / density than the rigidbody? Id looked for any property of the collider or the physics material, but there is no such thing.
I guess this is something that I have to calculate on my own and adjust the CO$$anonymous$$?
Thanks anyway!
correct, you must adjust the CO$$anonymous$$ AND ALSO the moments of inertia.
that is really what you're thinking about. I urge you to read up on inertial tensors. Cheers!
Answer by IndiePixel · Jun 13, 2018 at 05:57 PM
Howdy Everyone! I created a course on Udemy that covers how to set up Airplane Physics in Unity. not sure if it will help, but I wanted to post it here as it may help! Thanks!
Udemy Link: https://www.udemy.com/intro-to-airplane-physics-in-unity-3d/?couponCode=10DAOLLARPHYSICS
Youtube Link: https://www.youtube.com/watch?v=GTwoFXbmFa4
Your answer
![](https://koobas.hobune.stream/wayback/20220613081455im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What is the velocity on a given axis of a rigidbody? 2 Answers
airplane collision detection problem 1 Answer
Rigid body Help Please 1 Answer
Not all sides of a cube collide properly( with pic) 2 Answers
Character Controller meets Rigidbody 1 Answer