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

Zelda : Wind Waker... Good illusion but how ?!

Discussion in 'Physics' started by GalliCGames, Oct 29, 2015.

  1. GalliCGames

    GalliCGames

    Joined:
    Oct 29, 2015
    Posts:
    6
    Hi, i'm Zurcher Sebastien, 22 years old and i'm french (so excuse me for my bad english).

    With a friend we like a lot understand how thing are done in video game.
    And in the video game "Zelda : The Wind Waker" we'v tryed tounderstand something but at least.. impossible to undestand.

    I talk about the sea movement!

    We know about the sea is a big plane with some subdivision and the boat we play is on an axis and never move, it only can do rotation.

    Here a good begining to understand :
    http://simonschreibt.de/gat/zelda-wind-waker-hyrule-travel-guide/#update1 (sailing)

    Have you an idéa ? :D
     
  2. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    Instead of thinking of it as a plane, it might help instead to consider it as a grid. Each vertex rises and falls in a sinusoidal pattern, causing the faces to shift like the tidal motions of the ocean.

    Taking that to its logical conclusion, all you then need is some code that tells the grid how to flex each individual point.

    Also, your English is just fine! Bonjour aux mes amies Français! Bienvenue aux forums Anglais.
     
    Gigiwoo and GalliCGames like this.
  3. GalliCGames

    GalliCGames

    Joined:
    Oct 29, 2015
    Posts:
    6
    Bonjour :)

    You are right but now think about that :

    If we are the boat(player) and, the boat's origin is parent to the grid then the grid is following the boat!
    But ! if we add some object in the scene like barrel float or some other boat on the sea.

    i think about it and i still can't sleep ! how can we define the other boat buoyancy ?

    Imagine if the plane is animate like a real sea with some wave effect (up and down system) and we still know our boat is on a veticle fixed i'm confused about the other object on the scene (other bot, barrel, etc..)

    Thank a lot ! (i love English people ! ) ^^
     
  4. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    No problem. I'm actually American/Texan...but pretty close either way. ;)

    So - unless you absolutely need a faithful fluid simulation - I wouldn't think so much about actually simulating buoyancy as a function of an object displacing fluid and encountering resistance from the fluid and the air.

    Instead, as this is likely a secondary effect in your game, I'd recommend instead having a behavior on objects that interpolates the object towards a point on the normal of the grid polygon it is on. That way you can have a bobbing effect that appears like the pressure of the water is forcing the barrel or boat or whatever upwards, and the air pressure at sea level resisting and pushing it back down. Due to the fact that, as before, the faces of the grid are moving, the barrel or whatever will always remain in fluid-like motion.

    The only other thing that is worth considering is the buoyancy of the object in question; to get the physics to look right, you'll have to configure how buoyant the object in question is; a large pirate ship will have different physical properties than the barrel you mention.

    I hope that helps.
     
    Gigiwoo and GalliCGames like this.
  5. GalliCGames

    GalliCGames

    Joined:
    Oct 29, 2015
    Posts:
    6
    Of curse that help thank a lot !
    PS: sorry if i offanced you about (English) i was talking about Language, not about the country ^^

    It's a cartoon game we made and we realy don't want Physics in the game like random movement.
    That why i used Zelda exemple. In this game it's not about phisics, it's about annimation and location in space (xyz)

    I look for this kind of solution or idea to take :)
    Thank for your time !
     
    AndrewGrayGames likes this.
  6. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    No worries. It's very difficult to type with an accent anyways.

    No problem. Good luck on your game!
     
    GalliCGames likes this.
  7. GalliCGames

    GalliCGames

    Joined:
    Oct 29, 2015
    Posts:
    6
    Thank a lot !
     
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Buoyancy takes a little effort to achieve. Faking it is easier. But it's not that hard to add on to PhysX. Check out my game Pond Wars first to see what I'm talking about.

    The water surface is created by taking set of rigidbodys and connecting them via spring joints. The points are constrained to only move up and down. This is too expensive for 3D, you'll want to store all the points in an array and iterate across them. But it's the same idea.

    The water surface is then converted into a mesh using the triangulate script on the wiki. For a 3D application you may need your own triangulator, but with 3D you can get away with just building the mesh once and moving the vertices.

    Buoyancy is achieved by placing several colliders on the object to float. Each frame check the percentage of each collider that is under water. Then add an upwards force through the centre of the collider proportional to the percentage under water.

    And you are done. Enjoy. Feel free to ask questions.
     
    Ryiah and AndrewGrayGames like this.
  9. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Good thread. Moving it to a better forum.
    Gigi
     
    AndrewGrayGames likes this.
  10. GalliCGames

    GalliCGames

    Joined:
    Oct 29, 2015
    Posts:
    6
    Hmm..
    Your right BoredMormon but i'm scary about performance.

    If we use to much physics that will create some heavy performance needed ! no?
     
  11. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    For simple 2D projects the physics is fine. I have about 100 rigidbodys in Pond Wars and there is no noticeable effect.

    For 3D performance is an issue. 10,000 rigid bodies (100x100) is pretty much unrunnable. Even 15x15 gets a bit much.

    However there is no need to use the full blown physics system, or even GameObjects. Simply store the points as a 2D array of heights. Then iterate through the array adjusting the position of each point to be closer to its neighbours (Use something like Hooke's Law, you might need to store a velocity as well). This can be iterated through pretty quickly, I doubt you'd see any real performance issues.
     
    Gigiwoo likes this.
  12. GalliCGames

    GalliCGames

    Joined:
    Oct 29, 2015
    Posts:
    6
    Thank a lot for your help and idea ! You are right i'll try something like that :D