Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Usim flight module in Asset Store

Discussion in 'Made With Unity' started by Gabo_campitelli, Mar 9, 2014.

  1. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Sorry to those that bumped into the missing model in the p51. The fix has been submited but i don't know how much time will it delay.
    Anyway, to fix it now on your end, the model can be found in the p51 folder. Drop it as child of VC object, copy the transform values of the aircraft "external" model and paste it to the VC model and finally change the VC model layer to VirtualCockpit. Or wait for the update :)
     
  2. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    blacksun666 likes this.
  3. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    uSim VSF Plus has been released!
    AI module, autopilot and more extras.
    uSim VSF owners can upgrade for $12 to get the Plus version!
    Visit in the asset store.

    https://assetstore.unity.com/packages/slug/211736

    Note that both packages will keep recieving their respective updates and are both fully supported as allways. The main difference is that the Plus version has more features.

    Cheers!
     
    blacksun666 likes this.
  4. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    uSim VSF has been updated. (v1.52)
    Aerodynamics improvement.

    keep updated.

    Cheers!
     
  5. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Hello,

    More improvements to aerodynamics.
    I've added a function to calculate induced drag caused by lift. Currently drag was calculated with a custom curve much the same as lift coeficient curve. But with that implementation was hard to obtain good results.
    However after some testings with calculating just induced drag on the airfoils, the improvement is noticable. So i've corrected the airfoil class to allow automatic calculation of drag using the induced drag function. This eliminates the over head of having to nail the drag curve in relation to the lift curve.
    Althou 2 new parameters are needed to tweek for the induced drag function.
    - 0 angle drag coeficient (static drag?)
    - Wing aspect ratio.
    and an existing one that uses a new value range
    - Wing efficiency

    The package will be updated during next week.
    The new version also brings improvements to wind implementation and a working wind sock.

    This is a video of Virtual Aviator Online wich uses current uSim aerodynamics with the update. (and the wind dynamics)
    The video is a networked flight filmed form an observer in-game.

     
    Bartolomeus755 and khos like this.
  6. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Version has been updated
     
  7. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Hello,

    Here's a video of uSim VSF integrated with Crest Ocean Renderer. I will be adding a Crest support package in upcoming update.
    The buoyancy simulation is made with uSim using Crest height sampling function. And using Crest sphere colliders in conjuntion with a custom script to simulate water displacement based on simulation parameters.



    Cheers!
     
    khos and blacksun666 like this.
  8. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Hello, I have posted a basic tutorial video for aircrafts in uSim VSF. It also works for Plus version.
     
  9. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
  10. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
  11. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    hi, I bought it, and would like some advice on setting up external input.

    the demo scene: it spawns below ground etc, so I didn't test that.
    separate demos with each vehicle usable out-of-box would be better.

    what I did:
    - changed the InputManager.asset and set up my gamepad controller (workin)
    - added a script to set variables for usim vehicles: usimGP
    1. smaller issue: need 3 references to control a vehicle [UsimVehicle; InputsManager; EnginesManager]
    okay, I see there's UsimVehicle.engines for EnginesManager, but still two
    Code (CSharp):
    1.      
    2.         if (UsimVehicle.vehicleType == UsimVehicle.VehicleTypes.Air || UsimVehicle.vehicleType == UsimVehicle.VehicleTypes.Sea) {
    3.             InputsManager.throttle = GPControl.control.useGPC1.axisV2;  
    4.             InputsManager.rudder = GPControl.control.useGPC1.axisH2;
    5.         }
    6.  
    2. issue
    because throttle is not 0-1, cannot be (easily) controlled directly w InputsManager, the aircraft moves at apprx.10000
    so I thought EnginesManager.throttleInput will convert 0-1 input to real throttle values, but no
    then
    --- changed script exec order of usimGP
    --- commented out all EnginesManager references in InputsManager, so it does not overwrite
    --- removed all other vehicles in scene

    so now I don't know
    what causes the EnginesManager.throttleInput stay unchanged
    and what values should use for other variables if they are not 0-1 (or -1 - 1)
     
    Last edited: Nov 11, 2023
  12. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Hello, sorry for the dealy. i get messages faster on mail.
    For the engine, in engines manager, set throttle input type to direct.
    You can have two modes, direct = it means throttle is set to the value of input. Or contribute, Where the input valu adds to the throttle value. This last is used mostly for keyboards.

    "1. smaller issue: need 3 references to control a vehicle [UsimVehicle; InputsManager; EnginesManager]
    okay, I see there's UsimVehicle.engines for EnginesManager, but still two"

    uSim vehicle is used to diferenciate vehicle type, because air, land and sea vehicles use different inputs.
    InpusManager is where inputs are recieved in the vehicle. It could be Human or AI.
    EngenesManager is there mostly to support multiple engines and the beheviour of such engines.

    EnginesManager is in a child object. the others are in root object.

    I recomend seting values directly to the vehicle's InputsManager from an external custom script.
    uSim includes Standard and Rewired support. But you can use your own.

    Hope it helps
     
  13. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    I will add prefabs for joystick command in the asset next update.
     
  14. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    660
    no problem.
    okay, I get that. but isn't there a min-max value you use? and speed to reach that value? I guess those values are different for each vehicle (for example Cessna vs. F-14)

    after a bit of fiddling got it working.
    I'll rewrite the code in previous post to what works.
    but
    1. I don't see it in the documentation, the input variables could be separated as for which vehicle they are being used. those variables in InputsManager are mixed for ship, aircraft, car all there, right? they are all in range of (-1, 1)?

    2. how could I shorten the take-off distance (raise the speed?) for aircraft?

    also the prefabs and the spawned clones are different (using Unity2023.1)
    for example: on rudder/aero in HighliftDevice.cs the curve is set on clone, on prefab it's not
     
    Last edited: Nov 11, 2023
  15. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    1) I see what you mean. Yes, all axis are -1, 1. It's based on Unity standard inputs. If you have a device with range 0 to 1 then you have to alter the code. Just have in mind that engines manager throttle needs to be set to Direct for analog inputs. throttle is clamped 0 to 1 so a direct input of -1 is still 0. But that leaves half the input unsusable. You would have to make a custom math in that case. The only case i know would be for accelerator and brake axis pedals in some devices.
    The reason it's all mixed is because this is very old (10 years) asset and original it was intended just for air vehicles. then i added support for other vehicles to make amphibious vehicles. There are other bad design judgements made at the moment but changing core stuff would brake compability with old versions.I plan to make a new cleaner and more profesional version in the future.

    2) For air vehicles traction is at proppeller. You find the prop as child of the engine component. You can increase output curve value. (output coeficient in function of prop RPM) Look for prop.cs component documentation for more details.

    "also the prefabs and the spawned clones are different (using Unity2023.1)
    for example: on rudder/aero in HighliftDevice.cs the curve is set on clone, on prefab it's not"

    Some prefab connections may be broken. I'll be publishing an update for 2023.x

    Cheers!
     
    Last edited: Nov 11, 2023
    bobadi likes this.
  16. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Also have in mind that you don't have to stick to Demo Scene functions. Not even to the InputsManager. You can alter desired values of diferent components with a custom controller. It greatly depends on how you are going to implement the simulation in your project. uSim Demo scene can handle spawning a player vehicle and assigning the references. In the other hand if you want the vehicle to be at scene to be "used", you can have a custom prefab with all reference already set in the prefab. Also you will find support scripts for riding/unriding vehicles.
    I can guide you trough when ever you need. my mail is gabriel.campitelli@gmail.com
     
  17. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
  18. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Hello,

    Here's a small video of an example b17 cockpit in which i'm working using uSim Framework.



    cheers!
     
    Bartolomeus755 likes this.
  19. Gabo_campitelli

    Gabo_campitelli

    Joined:
    Oct 17, 2012
    Posts:
    426
    Last edited: Feb 29, 2024