You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I wanted to thank you for publishing your great work! Thanks for providing it here on github.
Now, I have a scene in which I would like simulate the flight of a glider (without thrust). However, a lot of gliders have longer fuselages than i.e. the cessna provided in the example. Now when adding colliders for the fuselage and the tail it distorts the real center of mass. In my situation, the center of mass is behind the wings, so the glider tilts backwards during stall, which is not realistic.
I had the idea that one could provide a custom (local) center of mass vector to override the calculated CoM world vector. So in my situation I did something like this in AirplanePhysics.cs:
publicbooluseCustomCoM;publicVector3customCoM;
...Vector3 com;if(useCustomCoM){com=rb.transform.TransformVector(customCoM);}else{com=rb.worldCenterOfMass;}// use com instead of rb.worldCenterOfMass
(This is just an example of how I tried to do it. Implementation would need to be tailored to the specific use).
However, I failed to update the gizmo drawing, since the custom CoM would also be used in AircraftGizmos.cs. Maybe someone has an idea how to solve that?
In addition, the input variable customCoM would probably be only needed when useCustomCoM is true, so one would need to create a custom unity editor script. This, however, overwrites the other fields.
Off Topic: I also wanted to ask: Is a downward elevator / tail force supported? It seems like the cessna example uses a positive lift for the tail). However, I learned that stable aircrafts use a negative lift (in the opposite direction of the wing lift), so that in case of a stall the aircraft tilts forward.
Edit:
I forgot that one could simply set rb.centerOfMass, so in effect, something like this should do the trick:
First of all, I wanted to thank you for publishing your great work! Thanks for providing it here on github.
Now, I have a scene in which I would like simulate the flight of a glider (without thrust). However, a lot of gliders have longer fuselages than i.e. the cessna provided in the example. Now when adding colliders for the fuselage and the tail it distorts the real center of mass. In my situation, the center of mass is behind the wings, so the glider tilts backwards during stall, which is not realistic.
I had the idea that one could provide a custom (local) center of mass vector to override the calculated CoM world vector. So in my situation I did something like this in
AirplanePhysics.cs
:(This is just an example of how I tried to do it. Implementation would need to be tailored to the specific use).
However, I failed to update the gizmo drawing, since the custom CoM would also be used in
AircraftGizmos.cs
. Maybe someone has an idea how to solve that?In addition, the input variable
customCoM
would probably be only needed whenuseCustomCoM
is true, so one would need to create a custom unity editor script. This, however, overwrites the other fields.Off Topic: I also wanted to ask: Is a downward elevator / tail force supported? It seems like the cessna example uses a positive lift for the tail). However, I learned that stable aircrafts use a negative lift (in the opposite direction of the wing lift), so that in case of a stall the aircraft tilts forward.
Edit:
I forgot that one could simply set
rb.centerOfMass
, so in effect, something like this should do the trick:(Sorry, not really optimized).
The text was updated successfully, but these errors were encountered: