How to make an FPS lean in Godot 4

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 20

  • @user-fl5hz1il7m
    @user-fl5hz1il7m 3 місяці тому +1

    In first person games its very important when you lean to have the up down left right movement of the mouse relative to the map, not relative to the leaned character. In my project the left right movement indeed it goes left right relative to the horizon even if Im leaned.. but unfortunately the up down is not relative to the map, it goes up down relative to the screen so it feels off. Maybe I will try the way you do it but I think it will be the same thing, I think it wont move camera relatively to the map.

  • @DanielAttaway
    @DanielAttaway 6 місяців тому +1

    Great content, i appreciate the attention to detail with preventing the camera from clipping into the wall. Nice work 🫡

  • @SoreBrain
    @SoreBrain 6 місяців тому +1

    Idk how the algorithm got me here but as a web dev this was super interesting.

  • @dahny6544
    @dahny6544 7 місяців тому +1

    Thanks you!! Your tutorials is the best!!

  • @ravenmonroe_
    @ravenmonroe_ 7 місяців тому

    Wow! This is very helpful. BTW, can you please make an FPS swimming tutorial? I've been looking for tutorials but I could not find any.

  • @bioburden
    @bioburden 7 місяців тому +1

    I notice that you implement a lot of features using animations - this really should be implemented via code.

    • @Chaff_Games
      @Chaff_Games  7 місяців тому

      I don’t think it’s that important. It can be either or. I’ve done it in code with tweens and ended up deciding on using this method for the video.

  • @AndroidACArcana
    @AndroidACArcana 7 місяців тому +2

    Do you notice the angle throwing your aim off? If you move your mouse left and right while leaning the character body rotates as normal, on a perfect plane with the ground. However, if you move the mouse up and down the rotation becomes slightly angled instead of perfectly vertical because the camera is rotated. This gets worse the further you allow the player to lean.
    I found in STALKER (I love that series so much) when you lean it did not throw off the axis for the up and down aiming, so I'm trying to figure out how to fix it the same way.

    • @Chaff_Games
      @Chaff_Games  7 місяців тому +1

      I haven’t noticed any but I’ll run since checks. We’re raycasting from the camera. So it should always be the centre point, unless specified otherwise

    • @AndroidACArcana
      @AndroidACArcana 7 місяців тому +1

      ​@@Chaff_Games Sorry, I'll clarify. The raycast is right, I'm not questioning that. What I mean is that it becomes harder to aim. Like if you want to direct your mouse onto a target, it becomes hard to snap your aim to the target. I am thinking this is because your x axis is perfectly horizontal but your y axis is not perfectly vertical once you are leaning.
      Further to this, I solved it more or less in my project now by also rotating the camera on it's y axis a bit based on the camera moving up and down (I divided the value by 3 for my project, but I think this would depend on what angle your lean is)
      Here is a video to help explain:
      ua-cam.com/video/x6nwhcfPqfo/v-deo.html

    • @Chaff_Games
      @Chaff_Games  7 місяців тому +1

      Ah yep I know what you mean, the pivot point for the camera is still in the centre so the camera no longer moves as expected. I noticed on the left/right more than the up down. But it’s definitely there.

    • @AndroidACArcana
      @AndroidACArcana 7 місяців тому

      @@Chaff_Games I don't know if you're interested in working on this, but I did fix it in my own controller by rotating my camera on the y axis (* 0.33) You might need a different value for your controller. My controller is not the same as yours, but there are a lot of similarities. I ended up with the following to compensate for the difference:
      character_body_3d.rotate_y(-camera_rotation.x)
      neck_pivot.rotate_x(-camera_rotation.y)
      if leaning == Lean.LEFT:
      neck_pivot.rotate_y(camera_rotation.y * lean_y_multiplier)
      elif leaning == Lean.RIGHT:
      neck_pivot.rotate_y(-camera_rotation.y * lean_y_multiplier)
      Also sorry for spam comments. I'm guessing you have comment moderation on and I thought they were getting removed because of the video link.

    • @Chaff_Games
      @Chaff_Games  7 місяців тому +1

      @AndroidACArcana thanks for that. I will take a look. I did notice the difference but decided to leave out fixing it for the sake of the video length. Sorry about that. As for moderation? I just have whatever is default, so maybe 🤣?

  • @pfstudiosgm
    @pfstudiosgm 7 місяців тому +2

    Can u add shooting sound effects to guns?

  • @Lansamatv
    @Lansamatv 7 місяців тому +1

    to make a multiplayer please

    • @Chaff_Games
      @Chaff_Games  7 місяців тому +1

      Maybe next year. It would not fit with the current project. So I need to see this done first. Also I don’t really have any experience with networking.

    • @Lansamatv
      @Lansamatv 7 місяців тому

      @@Chaff_Games Well, you're right, but for next year, we're going to veto the network.

  • @user-ut6yq8zb3z
    @user-ut6yq8zb3z 7 місяців тому +2

    first comment ❤‍🔥