Search Unity

Hovercraft physics

Discussion in 'Assets and Asset Store' started by Nevermind, Jun 27, 2014.

  1. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    So, I've just put together your go-to package, in case you want to make a game featuring hovercrafts. It contains modular scripts handling all hovercraft movement - hovering, accelerations, turning etc, player-controlled.
    Thrown in for good measure are scripts to attach effects and sound to your hovercraft, and even a simple model (it's kinda sucky, though. I'm a programmer, not an artist)

    Check the web demo here: https://www.assetstore.unity3d.com/en/#!/content/19041
    Or download a manual here: http://chaoscultgames.com/products/HoverWeb/manual.pdf

    The package is live on Asset Store: https://www.assetstore.unity3d.com/en/#!/content/19041
     
  2. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    I am actually interested in this but i will need my craft's physics to not always use world axis down as gravity and not just use the terrain to level itself against, but any mesh I choose. I.e. I would want my craft to fly up the side of skyscrapers and for that phase, all gravity should work as if the building is the ground plane... Can your kit do that?

    For instance, say I am making a hoverboard game (real sci fi style ) and i want my character to hover down the side of a mountain until ot reaches a 300 storey highrise. At that point the hoverboard start flying up the side of the building, competing against the other racers doing the same. At one point he gets to a huge billboard that runs between the current building and the next and he decides to take a shortcut bu activating the magnets on the boards and using the metal billboard as the surface to fly the next 5 minutes of the race on...

    Doing this would entail one of two things:
    1. Rotating the entire world and everything in it
    Or
    2. Gravity being alterred and only the craft behaving differently... This is the option I am rooting for.

    Can your kit do this?

    I've had this game in mind for ages... Really simple but i think it can be quite fun. I wanted to rease it for free (no pirchase to play and no in game pirchases, just free) once done but my need to pay bills has seen me putting this project on the back burner for ages now. If this kit can do that then it would significantly advance that project of mine. I would really love that! So give me some food news, yeah? :)

    Thanks
     
    Last edited: Jun 27, 2014
  3. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    OK, I didn't try this, but option 2 might actually work. The hovercraft does not "level itself to terrain", but honestly hovers using forces that are not required to be exactly downward. However, there are some "hacks" to make it behave better when horizontal, that may interfere with your idea.

    I'm gonna try to implement something like this and report back to you.
     
  4. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Thanks man... Rooting for you :D

    Since you are busy looking into this, instead of giving vague examples, let me tell you what I am actually after so you can give me an actual yes or no... I want to fly up the side of a large, cylindrical object like a castle tower for instance and i want to be able to fly around the object while on my way to the top. It would have been simpler to just keep the craft level and rotate the tower beneath me but once i reach the top, the craft will turn into a flying craft and level itself off to the world's gravity so that makes the whole "rotate the entire scene" thing less appealing... But yeah... 98% of the time the surface I will be flying up against will be cylindrical so I need to make it "hover above" the center of the Cylinder, but with "up" being any direction on the world's XZ plane.

    To simplify this my approach was to be a gravity marker that i parent my craft to. I would place this marker in the center of the towerand move it up in world y. I would then cast a ray to determine the distance from the wall to the center and add an offset to that to give the desired position of the craft. Then all i would have to do is add code to make the craft bob and weave a little bit and my hovercraft physics would be done...whichever way i turn the marker, the craft will face the same direction since it is a child object... In the same sense, when i fly to the sides, instead of adding forces to the craft I would instead just rotate the marker and Bob's your uncle...

    This was my approach and this is what I intended to do with the hovercraft. I take it your approach will be different but as long as i can fly up a tower and move around it while i do, you have yoirself a happy customer :)
     
    Last edited: Jun 27, 2014
  5. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    The webplayer demo link on the Asset Store links to the manual.
     
  6. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    OK, back from experimentation. If you just change gravity, the hovercraft basically works, but is kinda wonky. The camera becomes hopelessly confused, and the auto-flip-if-turned script does not work, but these are not intended to be game-ready anyway.
    Making three small fixes in three scripts make wonkiness go away and hovercraft works perfectly with any gravity - basically, replace Vector3.up with -Physics.gravity.normalized and you're good to go. I did not attempt to fix camera and auto-flipping, but I'm pretty sure it's not hard either.

    So you can definitely use this asset for hovering over any crazy meshes (-8 I'll think about adding gravity-detection to the package, but in the meantime, if you decide to use it, I can simply direct you to exact places where changes should be made.
     
  7. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    Thanks. I've submitted the fix, but it's not approved yet.
     
  8. Minchuilla

    Minchuilla

    Joined:
    Feb 28, 2014
    Posts:
    16
  9. Black-Season

    Black-Season

    Joined:
    Apr 11, 2015
    Posts:
    10
    your asset is really good, a I mentioned in the feedback, are you considering adding some extra commands?
    maybe a jump script (temporarily boosting the hover) or a turbo (same thing as jump I guess)
    I know I'm supposed to learn how to do it myself but I try asking first :)

    5 stars anyways, and for this price, 6 stars
     
  10. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    I'm basically done with this. I might add something if I have (or somebody suggests) a really interesting idea; but lumping and turbo are pretty obvious.
    For jumping, all you need is just push the craft up a bit a let physics do the rest (use Rigidbody.AddForce with ForceMode.Impulse)
    For turbo, I think increasing the MaxSpeed (and possibly MaxForwardAcceleration) of the engine temporarily should do the trick.
     
  11. PM2015

    PM2015

    Joined:
    Aug 20, 2015
    Posts:
    1
    If I wanted this to be more of a UFO type of thing (I like the controls I just need it to fly higher...), where would I need to go to add somekind of "up" command? And do you see any problems arising with the rest of the script(s) if i manage to do this?
    Thank You.
     
  12. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    I'd start by adding a script that increases HoverEngine's MaxHeight and maybe GroundForce dynamically. Don't forget that there are several engines on a hovercraft (3 on included model) and you'd need to change all of them.
    This should make the craft hover higher; but I suspect that when going very high the system would become wonky. I did not design it with flight in mind, but you can try and see what happens (-8
     
  13. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    This works great for me when I am in the Unity editor, but when I go to build the hovercraft goes full speed and starts spinning to the left. I cannot find anything in my set up that should cause this to happen. Any idea what might be happening?

    I also tried building the demo scene and had the same problem. I will try a clean install and see if I still have the problem.

    *Edit* clean install - same problem. Could it be incompatible with the new version of Unity?
     
    Last edited: Nov 28, 2016
  14. jaberwocky

    jaberwocky

    Joined:
    Nov 28, 2016
    Posts:
    106
    I figured it out on my own. I have a 3D space mouse and the driver was causing the problem.
     
  15. fisherman_b

    fisherman_b

    Joined:
    Dec 18, 2014
    Posts:
    36
    Hi,

    I tried to create my own hovercraft physics some time ago but never managed to solve one particular problem. Now I found this asset and I am wondering if it can work for me.

    Can your scripts make a hovercraft with multiple hover engines go up or down a slope (45 degrees or more) at a speed of 60 meter / second or more, without making the hovercraft wobble crazily like jelly?
     
  16. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    That's REALLY effing fast. To get this fast on a 45-degree slope (which is, by the way, REALLY effing steep!) you have to have enormous acceleration on flat terrain. I've tried to set it up for the hovercraft, and it looks possible, but any collision (and collisions are inevitable at such speeds) sends the car flying immediately, and it's basically impossible to control. I haven't played with it much - maybe increasing mass and drag to likewise enormous values may solve the problem... also, you need a specially crafted track to play at high speeds, and I tested with a bunch of gray cubes.

    I'm pleased to say that the hovercraft never wobbled like crazy jelly, though!
     
  17. fisherman_b

    fisherman_b

    Joined:
    Dec 18, 2014
    Posts:
    36
    Hey,

    I want to simulate 200 kilometers per hour /130 miles per hour in an optimized environment (ground is just a plane, no terrain or obstacles). Slopes don't have hard edges, their transition is smooth like butter to make it work :)
     
  18. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    139
    Hs anyone have a demo video of this asset working?, the demo link doesn't seem to be working and I am curious to see the hovercraft physics in motion