How To Make A Realistic FPS Flash Light ( Godot 4 )

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

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

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

    I'm really hype about using Godot since 4.3 coming soon

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

    This video actually helped me get a grasp of some concepts in Godot after transitioning from another engine. Thanks!

  • @f1x_my_power
    @f1x_my_power Год назад +8

    Awesome tut, very detailed disclosure of the topic, great result at the end! To slightly more improve the volumetric effect you could increase the Volume size and Volume Depth in project settings.

  • @Code_It_All
    @Code_It_All  Год назад +29

    Please Note A Few Things:
    1. The flashlight effect seen in the intro is achieved by adding another SpotLight to the existing SpotLight as a child, then increasing it's radius and lowering it's brightness and fog.
    2. You should normalize the direction before multiplying it by the speed so you're always moving the same speed at any direction, to normalize just add .normalize() after direction, however since we're using the Lerp method it's not super obvious.
    3. If you set the camera acceleration too low then the flashlight can move way faster than the camera and move out the screen, you can try to limit the flashlight rotation to -90 and +90 based on the player's forward transform (head.basis.z),
    tell me in the comments if you want a video for it.
    4. Sometimes you can see the starting point of the flashlight when you look down, too fix that adjust the Z axis of the SpotLight.
    5. Since this video was more about the realistic aspect of a indie horror game I didn't implement the logic for turning it off and on, if you want a part 2 of this video where I fix all of these issues please like this comment.

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

      any chance you could throw the code or explain how to do the third one, limiting the max rotation? would be much appreciated

    • @burreetos
      @burreetos 22 дня назад

      what to do when you look down and the flashlight doesn't follow

  • @Benjamin_Thio70
    @Benjamin_Thio70 10 месяцев назад +4

    Deserve more likes and views, good vid🎉

  • @wukerplank
    @wukerplank 11 месяцев назад +1

    Well done! I didn't know it was that easy to project an image. Instant subscribe 😎

  • @surepart
    @surepart 2 месяца назад +1

    I was finding that camera movement but i didn't expect finds that on this video

  • @AppMaker728
    @AppMaker728 5 месяцев назад +4

    I might use Godot to make a horror game since I like horror movies

  • @bobojenkins5805
    @bobojenkins5805 8 месяцев назад +4

    17:44 is what you clicked for

  • @TheSuperJLA
    @TheSuperJLA Год назад +6

    i believe you also need to normalize your direction so that you dont move faster when going diagonal.

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

      You are correct! You should normalize direction in any game you're making but I think in this example since we're using the Lerp function it's not super noticable.

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

    Hello friend, congratulations on your work, I'm looking for content about Godot because I intend to start in the area of game creation, and I found your channel and found it very interesting, what do you recommend for me who wants to start in this area? start with 2d or 3d games?
    Tips, what to study, how to get started, free courses preferably (I'm unemployed at the moment hahaha)
    Thank you for your attention, peace and success for you and your channel!!!

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

      Hey man I'm happy you liked this tutorial, it really depends what you want to develop do you want to make 2d games ? Start with 2d, you like making 3d games then you should start with 3d, although if you learn any of them switching to next one shouldn't be hard.

  • @Zu-hr1yz
    @Zu-hr1yz 10 месяцев назад

    Found it really useful. Thank you! I would also like to see the solution of making flashlight turn on and off. But for now I'll try to figure it out myself.
    upd: Alright. I managed to solve it by changing the value of light energy. Idk if this is the best option in terms of performance.

    • @Code_It_All
      @Code_It_All  10 месяцев назад +1

      You can also make it invisible,
      hand.visible = !hand.visible

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

    Thanks mate!!

  • @jayxofficial5126
    @jayxofficial5126 6 месяцев назад

    it was a great video but since the character's body doesn't rotate neither does the flashlight and it clips behind the character and creates a shadow. But over all this video gives people a chance to learn the basics.

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

    This man is sigmA

  • @kraig800i
    @kraig800i 10 месяцев назад

    This is the fourth tutorial I've watched on flash lights. Your tutorial is good. EXCEPT one thing is really starting to bug me.... How do you turn the flashlight on and off. I don't think I've ever played a game in which the flashlight cannot be turned on /off yet after four tutorials from people clearly cleverer than I, and still I have yet to know how to do this.

    • @Code_It_All
      @Code_It_All  10 месяцев назад +3

      Hey, Thanks for watching!
      The simplest thing that I can think of is this:
      If Input.is_action_just_pressed("YOUR_ACTION):
      hand.visible = !hand.visible

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

    this tutorial is awesome!!
    i followed it and it's perfect.
    only the spotlight can do a 360 (as in, turning it too much makes it face the player, where you can't even see the light anymore) which is a little bit odd. i don't know if this happens in the original code in the video.
    is there a way to stop that??

  • @Float212
    @Float212 8 месяцев назад

    If, say, i decided to choose my light source to be a candle, how would i extend the candle out?
    Should i use transform or translate or what should i do?

    • @Code_It_All
      @Code_It_All  8 месяцев назад

      If you mean an OmniLight then you could increase the radius, but I would say use a spot light with a high radius

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

    It's out but it's 4.3 beta

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

    helloo my when i drag my flashlight left or right it goes diagonally upwards and downwards and if i drag my mouse up and down nothing happens with it? i donno what i did wrong HELP PLZ

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

      Make sure your code is exactly as mine,
      Also make sure you attach the scripts to the correct node.

  • @MichaelH-zb8gg
    @MichaelH-zb8gg Год назад

    Great tut....
    I built it as per the tut. But I have a small issue when you move around the light beam in the fog trails behind the light movement so the beam becomes really wide, like it has some persistence then when you stop movement the light beam is fine. Any idea what might be causing this ?

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

      Hi michael, I'm glad you enjoyed this tutorial, in dark scenarios the fog does leave behind a trail due to the Temproal Reprojection In The Volumetric Light Settings on World Environment Node. Just disable Temporal Reprojection or adjust the amount of it to get rid of the trail.

    • @MichaelH-zb8gg
      @MichaelH-zb8gg Год назад

      @@Code_It_All That worked, thanks again.

  • @alexyoung2817
    @alexyoung2817 8 месяцев назад

    Hi I dont know if your gonna read this but,im struggling to make a switch for it like my input map is f and when i test for values using input func and if statememt to test if spotlight.show is true and and switch is pressed it doesnt work,well please give me another method on how to do this thanks,great coding btw😊

    • @Code_It_All
      @Code_It_All  8 месяцев назад

      Hello !
      You can toggle flashlight with this:
      if Input.is_action_just_pressed("action name"):
      hand.visible = !hand.visible

    • @alexyoung2817
      @alexyoung2817 8 месяцев назад

      @@Code_It_All awesome,your the goat thanks

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

    I seem to get Null error on camera3D and hand

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

      Make sure you refence the camera and hand correctly,
      Or you can just export camera and hand and then drag them in the spot.

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

    verry cool

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

    my camera goes diagonal i dunno why please help

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

      Hey, Are you sure you're NOT doing both of the rotations on the same node ?

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

    Please don't add mouse acceleration to a FPS style head controller, that's awful to control and nausea inducing.
    I suppose it's useful to know how to do, especially for keyboard controls where acceleration is necessary, and controllers where it can be helpful. But it shouldn't be used for mouse input events, or at the very, *very* least be an option.

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

      I guess that depends on the person playing the game, also the example on this video was way too much, you would probably use a much reasonable value for acceleration in a real game.
      however I agree adding an option to disable this.

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

    🤩 *Promosm*