React Three Fiber Tutorial - Rapier Physics Engine

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024
  • НаукаНаука

Комментарии • 50

  • @xxbondsxx
    @xxbondsxx Год назад +9

    It's awesome how composable these frameworks are -- used to be so much harder to set up little games like this!

    • @WawaSensei
      @WawaSensei  Год назад +4

      So much! Yet it's not as easy as Unity but the threejs/react-three-fiber community is working so hard and releasing a lot of things to make our life easier 🚀

  • @thomascaron4267
    @thomascaron4267 Год назад +2

    I usually never comment any video but this has to be the perfect short tutorial to fast-learn the basics of Rapier, understanding the RigidBody component and learning how to play with it and collision listeners is just PERFECT
    Thank you !

  • @olibeets
    @olibeets 9 месяцев назад

    Currently trying to hack things together and as normal rushing through documentation, so very handy to hear you very promptly mention the `type="fixed"` prop that was sorely needed on my static environmental objects! I was having performance issues probably because I have a bunch of overlapping static elements meant to provide collision. Navigating the three/fiber/rapier docs is a 3D puzzle game of its own!

    • @WawaSensei
      @WawaSensei  9 месяцев назад

      Let's go 🙌
      Indeed, feel like Sherlock Holmes (also looking into the lib issues and source code in GitHub is gold to find info)

  • @dev9887
    @dev9887 Год назад +1

    Very useful bro thanks. Won't be long before you get to 100k subs hopefully

    • @WawaSensei
      @WawaSensei  Год назад +1

      Ow 😻 Thank you very much, let's hope so 🔥

  • @PA-kh2yu
    @PA-kh2yu 10 месяцев назад

    excellent! quick and direct. thanks. A lot of documentation reading avoid

  • @Fiiilipes
    @Fiiilipes Год назад

    Wow this is insane! Thanks for this tutorial

    • @WawaSensei
      @WawaSensei  Год назад

      Glad you like it! Thanks to you 🙌

  • @JakeBerg777
    @JakeBerg777 Год назад

    Loved this. Thank you!!

    • @WawaSensei
      @WawaSensei  Год назад

      Glad you enjoyed it! 🙌 Thank you!

  • @mj2068
    @mj2068 5 месяцев назад

    wow it's unbelievable we can make games like this in less than 9 minutes. next, the sky's the limit.

  • @bone2119
    @bone2119 Год назад +1

    Hey Sensei, we want more of react three rapier. Thanks in advance

    • @WawaSensei
      @WawaSensei  Год назад +1

      Hey 🙌
      Thank you! There's already a bit more of Rapier on the channel with this project ➡️ ruclips.net/video/zwNF1-lsia8/видео.html

    • @AndyNotSoSmart
      @AndyNotSoSmart Год назад

      @@WawaSensei I'm doing that one next - I love Japan - I can read Katakana and minimal Hiragana and Kanji. Can't wait to get into that...

  • @peoplease_need
    @peoplease_need 5 месяцев назад +1

    Hi great video! im glad i found this

    • @WawaSensei
      @WawaSensei  5 месяцев назад +1

      Hi, thank you!
      Yes of course, and physics is great for this, it's a cool idea btw I'll try to make a video about it (but it shouldn't stop you to try achieving it on your own before!)

    • @peoplease_need
      @peoplease_need 5 месяцев назад

      @@WawaSensei im glad you think it's a good idea too! yes i'll try (im actually working on that project) and your video shows that rapier makes it even easier. of course i'd be happy to watch your next video about that ❤️‍🔥

  • @deathdefier45
    @deathdefier45 Год назад +1

    Sensei could you point me in the right direction I want to understand the physics better along with the mathematics that are involved in creating these amazing 3d projects. Thank you for this wonderful channel ❤

    • @WawaSensei
      @WawaSensei  Год назад +3

      Hi, I've found this article that could be a starting point in your research (www.toptal.com/game/video-game-physics-part-i-an-introduction-to-rigid-body-dynamics)
      I'd recommend you to understand rigid bodies & collisions, and what is possible to do with physics engine, rather to know under the hood how to code them... (unless you're really into it)

  • @ceyhunkoc6866
    @ceyhunkoc6866 4 месяца назад

    Hey! Just a quick tip:
    Don't use states in element because it handles rendering to react instead of webgl. You should set a ref to mesh and change it's material color in onPointerEnter event like ref.current.material.color = new THREE.Color('pink').

    • @Cyloonian
      @Cyloonian 4 месяца назад

      I'm curious and trying to figure out how you would actually write this in code. Is there a chance you could provide an example on how you would implement it? :)

    • @WawaSensei
      @WawaSensei  4 месяца назад

      Hey, I don't have this tutorial code in mind, but having React re-render won't kill your app (unless done at high frequency with components not meant for that and maybe it's the case in this project I don't remember)
      R3F components are memoized it's not the same thing than dom re-renders

    • @ceyhunkoc6866
      @ceyhunkoc6866 4 месяца назад

      @@WawaSensei the problem is when you use states for 3d objects and change one of those states, react will re-mount that 3d with new states and that process is on react render side and is really slow. Instead you want to do that process on faster webgl side. If you try to animate an object in useFrame and with states it reduces your fps greatly. Even if in your tutorial it doesnt affect it much, it is not a good practice. You can check it in pitfalls section of r3f documentation.

    • @WawaSensei
      @WawaSensei  4 месяца назад

      @@ceyhunkoc6866 they don’t say to not use useState but not update them in useFrame at high frequency (I wan to avoid beginners to be misled by your comment and stop using useState in their r3f project)

  • @anktsh292
    @anktsh292 Месяц назад

    Can i use it in React Native?

  • @heagandev
    @heagandev Год назад

    Great tutorial thank you. Can you explain why you defined the control map inside of useMemo?

    • @WawaSensei
      @WawaSensei  Год назад +1

      Thank you so much!
      I didn't "think" about it, I copied it from the documentation but I think it's because if it's memoized, the reference to the array won't change accross re-renders to avoid to cause re-render of the KeyboardControls children when the App component has a re-render.

  • @Venkatesh-vm4ll
    @Venkatesh-vm4ll Год назад +1

    Awesome ❤, what is your next project sir

    • @WawaSensei
      @WawaSensei  Год назад +3

      😍 I plan to do a small game with an animated character (Like one mini game from Fall Guys)

    • @Venkatesh-vm4ll
      @Venkatesh-vm4ll Год назад +1

      @@WawaSensei 🥰

  • @sergetelnov4945
    @sergetelnov4945 7 месяцев назад

    thank you for the tutorial, it's a great one!
    I have a question though, is there a way to reset the position of the object?
    I'm trying to solve this problem for a couple of days now ...

    • @WawaSensei
      @WawaSensei  7 месяцев назад +1

      Hey, what did you try to do it and what do you want to do exactly?
      Maybe joining the discord is better to get help
      lessons.wawasensei.dev/discord

  • @SemantaMana
    @SemantaMana 2 месяца назад

    Bro get error on useKeyboardControls, that is
    object null is not iterable (cannot read property Symbol(Symbol.iterator))
    TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
    please help me to overcome with the problem😢

  • @AndreGaspar-x3r
    @AndreGaspar-x3r Год назад

    great video, Im having a problem for weeks. Does anyone know how to get the current position of a rigidbody?

    • @WawaSensei
      @WawaSensei  Год назад

      Thank you!
      Yes -> rb.current.translation()
      If you need the threejs version do: vec3(rb.current.translation);
      Don't forget to import it -> import { vec3 } from "@react-three/rapier";

  • @kiranpoojary104
    @kiranpoojary104 Год назад

    have any idea how we can add score feature in it ?

    • @WawaSensei
      @WawaSensei  Год назад +1

      Hello, yes! You can use Zustand state manager to do it simply
      (github.com/pmndrs/zustand) I'm covering it in tomorrow's video

    • @kiranpoojary104
      @kiranpoojary104 Год назад

      @@WawaSensei thank you : )

  • @AndyNotSoSmart
    @AndyNotSoSmart Год назад

    Thanks for all your up to date @react-three/fiber tutorials. Is there a way to hack/modify Vite so that it hot-reloads the whole project whenever I save instead of just the single component? Single component hot-reload is awesome - would love to hear some use cases for it though outside of threejs.

    • @WawaSensei
      @WawaSensei  Год назад

      Thank you 🙌
      I have no idea for your question about Vite, why do you want to do it? You want the same behavior as reloading your tab?

  • @awsom8237
    @awsom8237 Год назад

    bro tryed to create this game but when the focus change its key stops working

    • @WawaSensei
      @WawaSensei  Год назад

      Hey, weird... Can you try updating react-three-fiber and drei libraries? Maybe it's a library bug that has been patched?
      If not you can join the Discord and we investigate it 🙌

  • @almahadydiallo4460
    @almahadydiallo4460 11 месяцев назад

    Hey sir how are you

    • @WawaSensei
      @WawaSensei  11 месяцев назад

      Great what about you?

    • @almahadydiallo4460
      @almahadydiallo4460 11 месяцев назад

      @@WawaSensei fine thanks. I just wanted to tell you that there is a little scrolling bug in your responsive portfolio project in the ScrollManager ! Sometimes while scrolling down it goes back up