Unity hoverboard in 10 steps (short tutorial)

Поділитися
Вставка
  • Опубліковано 2 кві 2020
  • I tried to explain how to make a hoverboard in Unity in 10 steps. For the physics material 'friction combine' setting, instead of 'minimum' you need to use multiply to make it frictionless.
  • Ігри

КОМЕНТАРІ • 98

  • @matt10y27
    @matt10y27 3 роки тому +37

    What the heck this is actually a really elegant solution.

  • @carterearles9528
    @carterearles9528 3 роки тому +15

    Your videos are the best. They’re short, simple, and in the end you understand everything cause all the code is yours. Keep it up man!

  • @spliter88
    @spliter88 3 роки тому +120

    I always have trouble with that last step

    • @Raul-pg1pf
      @Raul-pg1pf 3 роки тому +3

      lol

    • @ryan.j113
      @ryan.j113 Рік тому +1

      Pshh nah it's like sooo easy
      First you gotta... uhh... Y'know... Ummm

    • @tomatobuns
      @tomatobuns Рік тому

      dont think, just do

  • @EmmaZhao
    @EmmaZhao 2 роки тому +1

    Codeer be the one to save me with all these innovative elegant solutions thank you for sharing

  • @jishanahamed8592
    @jishanahamed8592 3 роки тому +1

    Surely the kind of tutorial needed as well as deserved!!!
    Keep up the good work!

  • @rishabh999100
    @rishabh999100 4 роки тому +10

    We need more man. I remember seeing this on Twitter. Keep it up 👍

  • @NapeTheGreat
    @NapeTheGreat 3 роки тому +2

    How the absolute heck do you not have more subs??? I’m definitely going to attempt this (probably as a vehicle instead of a hover board)
    Great video! I love this style of tutorials!

  • @jelmervdbij1672
    @jelmervdbij1672 3 роки тому +2

    man this is some top tier content, keep it up!!!

  • @bernardo5733
    @bernardo5733 3 роки тому +3

    Adding an inclination to the hooverboard when one side is higher in relation to the ground could be a good idea. That little drift which happens casually in movies when spaceships turn when being chased. Although, nice work, your game it's getting really interesting.

  • @generichuman_
    @generichuman_ 2 роки тому +1

    I would also suggest finding the lateral component of velocity (side to side) and adding a force to counteract this a bit, so you don't slide sideways as much. This also allows you to reduce the drag quite a bit while still retaining control when turning. And adding a slight roll torque to the board when turning adds some realism.

  • @ERBaruin
    @ERBaruin Рік тому

    This is so cool man. Good work!

  • @artemiyzubarev7068
    @artemiyzubarev7068 3 роки тому +5

    Last step: add a game to your hoverboard.

  • @croissantsa
    @croissantsa 4 роки тому

    this is amazing

  • @OmeedNOuhadi
    @OmeedNOuhadi 3 роки тому

    Awesome, thanks!!!

  • @omarhidoussi1557
    @omarhidoussi1557 4 роки тому

    thanks , this is awsome :))

  • @ErtBaran
    @ErtBaran 3 роки тому

    Nice, thanks.

  • @gamedevboy1181
    @gamedevboy1181 3 роки тому

    Nice very simple and nice

  • @timothygooding9544
    @timothygooding9544 3 роки тому

    great thing about this is that it can be used for multiple things, I'll see if it works for a boat

  • @arnaudrousseau2608
    @arnaudrousseau2608 3 роки тому +1

    Hi, I love your work! How did you attach th player to the hover board? I can't have a good look with a transform.parent ...

  • @eruphin3601
    @eruphin3601 2 роки тому

    I wonder if it's mostly the same and possibly even having lesser steps if it's just a literal board that stays on the ground but can still move the same

  • @HigaroVeloso
    @HigaroVeloso 5 місяців тому

    These lines you use, do you draw them by script or is it a feature of the unity debug?

  • @Zotelio
    @Zotelio 4 роки тому +1

    Hi man, i've followed your tuto, but my board side flip when is floating over a sphere.
    I've not understand well how to add force at position, how do you calculate the force to apply it ?

    • @blaccy5991
      @blaccy5991 4 роки тому +1

      to add force at position just use rigidbody.AddForceAtPosition();

    • @jmas2593
      @jmas2593 3 роки тому

      @@blaccy5991 what do we put in the parameters

    • @blaccy5991
      @blaccy5991 3 роки тому

      @@jmas2593
      You could up the mass, drag and angular drag buuttt.....
      you could also follow these steps:
      1. Make a hoverboard script
      2. Make a vector3 array
      Vector3[] Points;
      3. Make a function called Balance where you raycast down from your points and apply forces at the points
      Example:
      for (int i = 0; i < points.length; i++)
      float amount = // distance between points[i] and raycastHit
      rb.addForceAtPosition(points[i], vector3.up * mathf.abs(amount));
      4. Add damping based on height of point - desired height using the code I wrote before.
      5. Up the mass, drag and angular drag 😁

    • @anytech1876
      @anytech1876 2 роки тому

      I am noob in noob in unity so can you just paste the whole script here😭

    • @generichuman_
      @generichuman_ 2 роки тому

      For the force, use a raycast that travels the distance you want the board to hover above the ground (desiredHeight). Then use Mathf.Pow((desiredHeight - hit.distance), 2) * someConstant. The power factor just gives the force an inverse square feel which is more realistic for a force field, and the constant is a scaling factor you can tweak until the hover seems right. I would also use ForceMode.Acceleration for adding forces, so it isn't dependant on the rigidbody mass.
      It also helps to add a transform below the hoverboard and set this as the boards center of mass (rigidbody property). This will lower it's center of gravity.

  • @coprguy58
    @coprguy58 Рік тому

    just a lil question : how do we raycast just tell me how or the code so i could understand cuz I use visual scripting (in 2021 version)

  • @takumifujiwara2073
    @takumifujiwara2073 Рік тому

    how do you change the height at which it hovers?

  • @TheEarlyAstrotype1024
    @TheEarlyAstrotype1024 2 роки тому

    Someday I will create a wipeout like game

  • @jixs4v
    @jixs4v 3 роки тому

    Or you could just cheese it and animate the collider and position through code

  • @TheEarlyAstrotype1024
    @TheEarlyAstrotype1024 2 роки тому

    What if the raycast points are in the front, back, left and right. In the edges instead of corners?
    Also what if you put 9 raycast points? Let's say the 4 raycast points in the corners are shorter and the other 5 raycast points (front, back, left, right and center) are longer.

    • @raphaelguionaud7839
      @raphaelguionaud7839 2 роки тому +1

      The more raycast points you have the more accurately you will be sampling the height of the terrain, so in theory it can only make the movement of the hoverboard look more realistic. However if performance is an issue a small number like 4 should probably be enough. Another consideration is how much is the terrain actually varying? If the terrain is mostly smooth and only changed height gradually you won’t get that much of an advantage by sampling the terrain lots and lots of times compared to only a few times.

    • @TheEarlyAstrotype1024
      @TheEarlyAstrotype1024 2 роки тому

      @@raphaelguionaud7839 Thanks for telling me about this. I was thinking about the hover physics for anti-gravity racing ships like Wipeout Omega Collection. I also wanted it to work on really rough terrains, racetrack borders and racetrack edges that don't have borders. This is when I thought putting four raycast points on the corners might not be good for the hover physics I want. Game physics can affect the gameplay a lot, so I have to be considerate about it.
      Just thinking about these things in game development really interests and amazes me a lot.

  • @secutexy646
    @secutexy646 3 роки тому

    can you tell me your pc specs??

  • @reold
    @reold Рік тому

    "10. Add a game" 💀

  • @sudhanshlone8284
    @sudhanshlone8284 4 роки тому +11

    Can you show the code in the videos it will really help for noobs like me

    • @pokerroler
      @pokerroler 4 роки тому +5

      I am actually doing it. Once is finish i will give to u

    • @George-pk5jw
      @George-pk5jw 4 роки тому

      @@pokerroler Are you done ?

    • @pokerroler
      @pokerroler 4 роки тому +1

      @@George-pk5jw sorry guys complete forgot give 1 more day that im having trouble with other things

    • @George-pk5jw
      @George-pk5jw 4 роки тому

      @@pokerroler No problem, waiting

    • @pokerroler
      @pokerroler 4 роки тому

      @@George-pk5jw im actually having a problem with an if but is almost done

  • @cinemacat4108
    @cinemacat4108 3 роки тому +1

    The 10 step is the easiest one

  • @kwaku8316
    @kwaku8316 4 роки тому

    If it's ok can you make an in depth tutorial

    • @kintrix007
      @kintrix007 3 роки тому

      I think the point of this is that it's simplistic, yet easy to understand. If you can't do one step by yourself, there are many great resources to learn those steps from.

    • @kwaku8316
      @kwaku8316 3 роки тому +1

      @@kintrix007 Im no big brain coder so thats why, im not familiar with unity.

    • @kintrix007
      @kintrix007 3 роки тому

      @@kwaku8316 What I was trying to say is, if for example you don't know how to use raycasts you can search "Unity Raycast" or "How to use Unity raycasts" etc... The steps he described already have an oversaturated amount of tutorials.

    • @kwaku8316
      @kwaku8316 3 роки тому

      @@kintrix007 Thats the things I didn't know it was called ray cast

    • @kintrix007
      @kintrix007 3 роки тому

      @@kwaku8316 "3. Raycast down from the points to find distance to the ground"
      Of course, it's not that hard to actually miss it, so that's understandable.
      Good luck, though!

  • @TheEarlyAstrotype1024
    @TheEarlyAstrotype1024 2 роки тому

    0:15 How to make those lines and points appear?

    • @TheEarlyAstrotype1024
      @TheEarlyAstrotype1024 Рік тому

      okay now I know while ago, it's the Gizmos methods called in OnDrawGizmos()
      Gizmos.DrawRay() and Gizmos.DrawSphere()

  • @NikhilKumar-op3oj
    @NikhilKumar-op3oj 3 роки тому

    damn

  • @shahhussain3134
    @shahhussain3134 2 роки тому

    Hi can anyone teach me the turning part, i am unable to handle the torque, pls.

    • @ignacynoszczak1806
      @ignacynoszczak1806 2 роки тому

      Hi how does your code look like? or have you solved issue already?

    • @generichuman_
      @generichuman_ 2 роки тому

      rigidbody.AddTorque(hoverboard.up, torqueAmount, ForceMode.Acceleration);

  • @notkeehan
    @notkeehan 3 роки тому +1

    You wouldn't get this from any other guy

  • @hetparekh21
    @hetparekh21 3 роки тому

    How to add points. Please make a tutorial on that. I really need that

    • @ThunderStormFortnite
      @ThunderStormFortnite 3 роки тому

      they're just gizmos if u want just put empty without the gizmos

  • @maindepth8830
    @maindepth8830 3 роки тому

    This can easily be used as an enemy drone

    • @AhmedMohamed-zj1qc
      @AhmedMohamed-zj1qc 3 роки тому

      Why would u make it that complicated?

    • @maindepth8830
      @maindepth8830 3 роки тому

      @@AhmedMohamed-zj1qc wait is there simpler way, this is how i implemented it in my projecy

    • @AhmedMohamed-zj1qc
      @AhmedMohamed-zj1qc 3 роки тому +1

      @@maindepth8830 i mean yes there is a simpler way but like i assure you that this way is better but anyway i dont really care abt polishing my projects so keep doing it the way ur doing it😁

    • @maindepth8830
      @maindepth8830 3 роки тому

      @@AhmedMohamed-zj1qc ah thank you

  • @josimar8497
    @josimar8497 4 роки тому

    How can I make the hoverboard follow this points?

    • @Codeer
      @Codeer  4 роки тому +2

      Do you mean how to use the points to make it hover? You can use AddForceAtPosition for every point to keep it floating in the air.

    • @josimar8497
      @josimar8497 4 роки тому

      @@Codeer I made this, but only the points is floating, Sorry I'm new on unity

    • @Codeer
      @Codeer  4 роки тому

      @@josimar8497 make sure to parent the points to your hoverboard and apply the forces upwards to a rigidbody attached to the hoverboard itself.

    • @josimar8497
      @josimar8497 4 роки тому

      @@Codeer Ok thank you very much

    • @josimar8497
      @josimar8497 4 роки тому

      @@Codeer Works nice! Thanks

  • @kwaku8316
    @kwaku8316 4 роки тому

    @codeer, How do you add "point"

    • @ThunderStormFortnite
      @ThunderStormFortnite 3 роки тому

      its just gizmos, u can just use an empty if u want the point use this in the script:
      private void OnDrawGizmos()
      {
      Gizmos.color = Color.red;
      Gizmos.DrawSphere(transform.position, 1);
      Gizmos.DrawSphere(hit.point, 1);
      }

  • @evgenkonyshock4913
    @evgenkonyshock4913 3 роки тому +1

    Step 10 unclear