CAMERA SHAKE in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024
  • Get the Complete Unity 3D Game Development Course: www.udemy.com/...
    Spice up your game by adding Camera Shake using Unity!
    Coroutines: docs.unity3d.c...
    EZ Camera Shaker has been deprecated from the Asset Store. Instead check out this open source version: github.com/and...
    Thumbnail image taken from the awesome game Besiege. Check it out here: www.besiege.spiderlinggames.co.uk
    ❤️ Donate: www.paypal.com...
    ····················································································
    ► Join Discord: / discord
    ♥ Subscribe: bit.ly/1kMekJV
    ● Website: brackeys.com/
    ● Facebook: / brackeys
    ● Twitter: / brackeystweet
    ········································­­·······································­·­····
    Edited by the lovely Sofibab.
    ········································­­·······································­·­····
    ► All content by Brackeys is 100% free. We believe that education should be available for everyone.
    ❤️ Donate: www.paypal.com...
    ········································­­·······································­·­····
    ♪ Baby Plays Electro Games
    teknoaxe.com/cg...
    ♪ "ES_Brooklyn Flava 2 - Mattias Andreasson" by Epidemic Sound (www.epidemicsou...)’

ความคิดเห็น • 616

  • @creator_2013
    @creator_2013 6 ปีที่แล้ว +2015

    *How to become a good Unity developer:*
    Step 1 - Programm everything yourself
    Step 2 - Just delete your code and use something from the asset store

    • @elektra81516
      @elektra81516 6 ปีที่แล้ว +297

      As much of a joke that this is, programming things yourself gives you more flexability and control as well as a sense of pride and acomplishment

    • @theycallmemrglass
      @theycallmemrglass 6 ปีที่แล้ว +6

      lol

    • @supatroopa5097
      @supatroopa5097 6 ปีที่แล้ว +19

      too real

    • @gamedesignwithmichael
      @gamedesignwithmichael 6 ปีที่แล้ว +7

      "good" haha

    • @hahahpizza
      @hahahpizza 6 ปีที่แล้ว +6

      He gave us both the options bitch.

  • @UnidayStudio
    @UnidayStudio 6 ปีที่แล้ว +456

    8:49 best sound effect ever

    • @youngtozen4168
      @youngtozen4168 6 ปีที่แล้ว +5

      fart?

    • @VeNoM0619
      @VeNoM0619 6 ปีที่แล้ว +18

      I was not prepared for that, and bust out laughing. That was just genuine comedy.

    • @guldberg75
      @guldberg75 6 ปีที่แล้ว +2

      Hahaha, i was expecting a cool effect for real..

    • @Necronomicron8
      @Necronomicron8 6 ปีที่แล้ว +1

      Where can I buy this asset? :D

    • @davidberger5745
      @davidberger5745 6 ปีที่แล้ว

      Uniday Studio nn

  • @leyamst
    @leyamst 6 ปีที่แล้ว +233

    I was literally scripting my guns in my game and this video gets uploaded right when I needed it.

  • @Natalatalei
    @Natalatalei 6 ปีที่แล้ว +316

    Can we get a tutorial on how to do that sound effect you used at the end, seems advanced.

    • @-no9039
      @-no9039 4 ปีที่แล้ว +2

      yes i hope he do a tutorial

    • @zlayer2881
      @zlayer2881 4 ปีที่แล้ว +1

      @@-no9039 lmao

    • @-no9039
      @-no9039 4 ปีที่แล้ว +1

      @@zlayer2881 sorry i don't understand

    • @pinnerplay5435
      @pinnerplay5435 4 ปีที่แล้ว +1

      I think you may just download an effect and to play it on click you may make a script in c#

    • @Pickygamingz
      @Pickygamingz 4 ปีที่แล้ว +1

      @@-no9039 the end sound was spit lola

  • @Lugmillord
    @Lugmillord 6 ปีที่แล้ว +53

    Recommendation: Instead of Random.Range, try some noise functions. They make the shake less erratic and a bit more realistic. There's a great GDC video about that.

  • @heatblayze
    @heatblayze 6 ปีที่แล้ว +213

    I already know 99% of the stuff you publish, but for some reason I just love watching your videos

    • @Rambolink94
      @Rambolink94 6 ปีที่แล้ว

      Same here!

    • @philliptemidayo
      @philliptemidayo 6 ปีที่แล้ว +6

      I also know most of it, but sometimes, his videos give me a better and easier way to optimize my codes. No knowledge is lost ;)

    • @albarnie1168
      @albarnie1168 6 ปีที่แล้ว

      Same!

    • @limageur
      @limageur 5 ปีที่แล้ว +1

      Where have you learn ?

    • @needful3961
      @needful3961 4 ปีที่แล้ว +1

      Me neither

  • @smokinjoeee
    @smokinjoeee 6 ปีที่แล้ว +55

    pro tip: at the beginning of every Brackeys video, freeze it; you'll get a pretty good look at what he looks like high

    • @chrisc7265
      @chrisc7265 6 ปีที่แล้ว +5

      the real challenge is trying to figure out what he looks like not high

  • @guldberg75
    @guldberg75 6 ปีที่แล้ว +1

    I like that you show both how to start writing your own shake, and then also shows a good assets - but unlike most you also import the asset and shows how to actually use it.

  • @Dorbellprod
    @Dorbellprod 4 ปีที่แล้ว +331

    "Go back into unity, there should be no errors"
    My Console: ❗️❗️❗️❗️❗️❗️❗️
    As of October 2, 2021, I officially no longer like this comment.

    • @2016hondacrv
      @2016hondacrv 4 ปีที่แล้ว +2

      Same :D I did a typo though :)

    • @raiqaariz4711
      @raiqaariz4711 4 ปีที่แล้ว

      169

    • @raiqaariz4711
      @raiqaariz4711 4 ปีที่แล้ว

      HAHHAHA I RUINED IT DONT KILL ME

    • @user-nz4dr1sy5g
      @user-nz4dr1sy5g 4 ปีที่แล้ว

      "; ;" its all it takes

    • @kivo3592
      @kivo3592 4 ปีที่แล้ว

      can someone heweeeellllp my console wants to kill itself

  • @WyattLee
    @WyattLee 6 ปีที่แล้ว +12

    I just want to say thank you... You have helped me out in my programming experience, and I couldn't do any of it without your easy-to-learn explanations. I hope someday to be able to make games as good as you...

  • @ipadize
    @ipadize 4 ปีที่แล้ว +9

    when you made that soundeffect, i felt that

  • @sparrowhawk81
    @sparrowhawk81 6 ปีที่แล้ว +4

    DOTween is great for this kind of stuff. Even the free version has some really cool extensions for camera shake, punching out the scale of things to make them "pop". You can "tween" any value you want pretty easily too.

  • @iBertuh
    @iBertuh 3 ปีที่แล้ว

    when i shake, the camera for an instance goes at the beginning and doesnt do the expected effect. any help??

  • @stannisbarracuda5693
    @stannisbarracuda5693 6 ปีที่แล้ว +36

    me as a beginner programmer still watchin his class and arrays videos this looks like magic to me

    • @drowsy5384
      @drowsy5384 6 ปีที่แล้ว +4

      stannis Barracuda You really shouldn't be watching any of this without base desirably C based language knowledge

    • @Buggzys
      @Buggzys 6 ปีที่แล้ว +11

      Green Shadow dont listen to this guy, people all over say things like this but you learn so much from these types of videos that you can apply later on

    • @kaf3in0
      @kaf3in0 6 ปีที่แล้ว

      Yeah, totally, perhaps you don't learn quite as much as if you would understand basic stuff, but there is still something to learn here. It's cool to see what you could be able to do and get more familiar with the code syntax. However, it's not good either to just watch these videos if you don't understand the basics.

    • @Buggzys
      @Buggzys 6 ปีที่แล้ว +5

      Kaf3in0 B Yeah that is true, I sounded kind of rude responding to that other guy but you should never be discouraged to watch a video that you dont fully understand. Videos like these used to motivate me to learn and practice more to achieve this type of success.

    • @joshfry6868
      @joshfry6868 6 ปีที่แล้ว

      it'll grow on you. Keep learning.

  • @ploopploop
    @ploopploop 4 ปีที่แล้ว +4

    The fact that this is one of the only and few camera effects that don't get broken with HDRP deserves an extra comment after 2 years

  • @icades5157
    @icades5157 6 ปีที่แล้ว +5

    8:50 the best sound effect I've ever heard. Gotta download it.

  • @5fercho5
    @5fercho5 6 ปีที่แล้ว +19

    Brackeys: "Now we need some sound effects"
    Me: Wow! what a complete tutorial!!
    Brackeys: *Mouth sounds*

  • @sykoo
    @sykoo 6 ปีที่แล้ว +322

    Heeeeeeeey, I started *shaking* because of that pun! Am I part of the joke-class now? 👏

  • @drew6107
    @drew6107 5 ปีที่แล้ว +2

    btw the cute way to do this is to put the starting of the coroutine inside of a different function inside of your camera shake object, and just calling that function every time so you dont have to use weird different syntax.

  • @ThylineTheGay
    @ThylineTheGay 4 ปีที่แล้ว +3

    0:46 every mobile game "dev" be like: "yes i need that tutorial, no not the game development part, the ad part"

  • @omarbdrn
    @omarbdrn 6 ปีที่แล้ว

    I love you. I'm an Egyptian programmer . I learned many at unity because of you

  • @abbymeister2188
    @abbymeister2188 3 ปีที่แล้ว +1

    Me: trying to relax listening to the sounds of the forest
    *puts on brackeys video instead

    • @yourfellowgamer487
      @yourfellowgamer487 3 ปีที่แล้ว

      I have found this comment by sorting all of these comments by the Newest First. You have gotten yourself the award of, "The Newest Comment as of 7-24-2021"

    • @abbymeister2188
      @abbymeister2188 3 ปีที่แล้ว

      @@yourfellowgamer487 Thank you, i guess.

  • @lens3973
    @lens3973 4 ปีที่แล้ว +1

    Yo your sound effects are so good you should upload them on the Unity Store

  • @bl4ckscor3
    @bl4ckscor3 6 ปีที่แล้ว +3

    That sound effect had me laughing for a bit :D

  • @Mr.Coldfire421
    @Mr.Coldfire421 6 ปีที่แล้ว

    The very awesome part you did is the sound effects. I didn't see that coming.

  • @touhidrabbenyshafin8471
    @touhidrabbenyshafin8471 3 ปีที่แล้ว

    The sound effect was awesome! 8:49

  •  2 ปีที่แล้ว +1

    I miss you, Brackeys ! I hope you and your team are doing well

  • @cooperfeld
    @cooperfeld 5 ปีที่แล้ว +1

    Agreed with keeping this self-programmed instead of using an asset, as it's just a few lines of understandable code. The asset only adds dependency to your project.
    Also since you have a 3D scene and perspective cam, you rather want to randomize camera.rotation than camera.position, because this will effectively pan the whole screen like a "flat image". Randomizing only the position pans objects close to camera much more than farther objects - unless you really want that effect.

  • @WowleraTV
    @WowleraTV 4 ปีที่แล้ว

    Hi! I have a trouble with this shake effect. I need it for my 2D game. I have camera and canvas with background and characters. I set Canvas Render Mode to Screen Space - Camera and applied this code. It works on the Scene screen, i can see correct shake effect but on the Game screen nothing happens. What shall i do, help me pls?

  • @YoutubeChannel-oq6ss
    @YoutubeChannel-oq6ss 4 ปีที่แล้ว +4

    Hello, if for some reason your code is not working, rewrite it like this... this works for me
    public class CameraShake : MonoBehaviour
    {
    // Set up data
    bool shake = false;
    float duration;
    float magnitude;
    Vector3 originalPos;
    float elapsed;
    // Shake the screen
    public IEnumerator Shake (float duration, float magnitude)
    {
    // Setup data for camera to be shaked
    shake = true;
    this.duration = duration;
    this.magnitude = magnitude;
    yield return 0;
    }
    void Update()
    {
    // Shake the camera
    if (shake)
    {
    if (elapsed == 0.0f)
    {
    Vector3 originalPos = transform.localPosition; // Save the original position
    }
    // Every frame, offset the camera's x and y position for duration seconds for duration seconds
    if (elapsed < duration)
    {
    float x = Random.Range(-1, 1f) * magnitude;
    float y = Random.Range(-1, 1f) * magnitude;
    transform.localPosition = new Vector3(x, y, originalPos.z);
    elapsed += Time.deltaTime;
    }
    else // Reset data
    {
    transform.localPosition = Vector3.zero;
    shake = false;
    elapsed = 0.0f;
    }
    }
    }
    }

  • @MrDylanButton
    @MrDylanButton 3 ปีที่แล้ว +1

    For anyone whose script is not working nowadays, this works for me
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class CamShake : MonoBehaviour
    {
    public IEnumerator Shake(float duration, float magnitude)
    {
    Vector3 originalPos = transform.localPosition;
    float elapsed = 0.0f;
    while (elapsed < duration)
    {
    float x =Random.Range(-1f, 1f) * magnitude;
    float y =Random.Range(-1f, 1f) * magnitude;
    transform.localPosition = new Vector2(originalPos.x + x, originalPos.y + y);
    elapsed += Time.deltaTime;
    yield return null;

    }
    transform.localPosition = originalPos;
    }
    }

    • @MrDylanButton
      @MrDylanButton 3 ปีที่แล้ว

      @Sicko no problem! Glad I could help

  • @jhrch4389
    @jhrch4389 6 ปีที่แล้ว

    I can’t explain how much you helped me out

  • @IrfuTuber
    @IrfuTuber 3 ปีที่แล้ว +1

    And this is guys how the Quarantine started all because of my man Big Brack.

  • @LunxriTV
    @LunxriTV 4 ปีที่แล้ว

    That sound affect doe. seems really advanced

  • @joshfry6868
    @joshfry6868 6 ปีที่แล้ว

    Dude nice! This is one of the first times I've seen a practical use of a coroutine. I'm sure there are tons though. Thanks!

  • @smartandfunny6140
    @smartandfunny6140 6 ปีที่แล้ว +33

    can i use your sound effect 8:50 for my game ?

    • @Brackeys
      @Brackeys  6 ปีที่แล้ว +36

      Haha, sure! :D

    • @thelocalbogan5605
      @thelocalbogan5605 5 ปีที่แล้ว +1

      @@Brackeys YEEEET

    • @SagorHossen2020
      @SagorHossen2020 5 ปีที่แล้ว +4

      i wanna use this sound in my video as Fart's sound instead of explosion

  • @docill9155
    @docill9155 6 ปีที่แล้ว

    Another tool worth looking at, if you want more control over your camera shake, is Perlin noise. I highly suggest any budding developer to look up camera shaking with Perlin noise, as it has many other applications (procedural world generation, drunken walking, etc).

  • @hughmarch5909
    @hughmarch5909 6 ปีที่แล้ว +2

    Hey Brackeys, instead of parenting the camera, you could also set the local position to new Vector3(x + OriginalPos.x, y + OriginalPos.y, OriginalPos.z)

    • @theteeppi
      @theteeppi 5 หลายเดือนก่อน

      Bruh, thank you so much, that saved me such a hassle. comment was 6 years ago, but still helping out here xd

  • @2dinunity10
    @2dinunity10 6 ปีที่แล้ว +2

    This is sweet and simple, and also really smooth (this goes under the camera game object)
    void OnPreRender(){
    if (sinceShakeTime > 0.0f) {
    lastPos = Random.insideUnitCircle * shakeIntensity;
    transform.localPosition = transform.localPosition + lastPos;
    void OnPostRender(){
    if (sinceShakeTime > 0.0f) {
    transform.localPosition = transform.localPosition - lastPos;
    sinceShakeTime -= Time.deltaTime;

  • @juts89
    @juts89 6 ปีที่แล้ว

    sweet with this plus your menu videos I can make a menu to disable camera shake. That's my favorite setting.

  • @appleseedgames6934
    @appleseedgames6934 4 ปีที่แล้ว +3

    The asset store camera shake is fine IF you don't ever reset your scene because it fucks the camera

  • @LunaMakesGames
    @LunaMakesGames 6 ปีที่แล้ว

    The thumbnail is a Besiege screenshot xD (good job DAN)

  • @felixp535
    @felixp535 6 ปีที่แล้ว +55

    Where can I download that amazing sound effect at the end? Link please

    • @markiewicz.szymon
      @markiewicz.szymon 6 ปีที่แล้ว +12

      Darknet only

    • @quic5HD
      @quic5HD 6 ปีที่แล้ว +1

      John LaBrie I really hope you are joking

    •  6 ปีที่แล้ว +1

      Pls share. I also need it

    • @Definitely_a_Fox
      @Definitely_a_Fox 6 ปีที่แล้ว

      I NEED!

    • @EmberAlberson
      @EmberAlberson 6 ปีที่แล้ว +1

      Fruidacity

  • @HiitsmeSsevasB
    @HiitsmeSsevasB 6 ปีที่แล้ว

    Oh man 8:49 im ready for that sound effects tutorial.
    Great tutorial, was looking for a camera shake one :D

  • @NickFarrow
    @NickFarrow 5 ปีที่แล้ว +8

    If anyone is having an issue like me were the camera went a little too wild I've modified Brackeys script a bit.
    public IEnumerator Shake (float duration, float magnitude){

    Vector3 originalPos = transform.localPosition;
    float elapsed = 0.0f;
    while (elapsed < duration) {
    float x = Random.Range(-1f,1f) * magnitude;
    float y = Random.Range(-1f,1f) * magnitude;
    float z = Random.Range(-1f,1f) * magnitude;
    //transform.localPosition = new Vector3 (x, y, z);
    transform.localPosition = new Vector3 (originalPos.x + x, originalPos.y + y, originalPos.z + z);
    elapsed += Time.deltaTime;
    yield return null;
    }
    transform.localPosition = originalPos;

  • @USNTM2
    @USNTM2 6 ปีที่แล้ว +1

    8:52 "PPPPFFFFFFF!" Loved the sound effect!

  • @dutch8700
    @dutch8700 6 ปีที่แล้ว +2

    Please do a tutorial where you give us a project that you made but there are a few problems and you have to go fix them.
    Thanks in advance dude
    Also congrats on 400k subs

  • @abdoudjam6846
    @abdoudjam6846 6 ปีที่แล้ว

    That final sound effect Lol ! you're getting better at telling jokes ,,, Thanks man you and your team are awesome !

  • @rohitchalak6379
    @rohitchalak6379 4 ปีที่แล้ว +1

    I am making a 2d game and want to use this but whenever it shakes the position of camera gets all messed up. How do I fix this?

  • @isteyak78
    @isteyak78 ปีที่แล้ว

    how he tries to cover up his jokes is 10x funny then any jokes🤣

  • @SuperNecroticOH
    @SuperNecroticOH ปีที่แล้ว

    he is always smiling!

  • @whywhywhy001
    @whywhywhy001 6 ปีที่แล้ว

    The EZ CameraShake is awesome! Thanks for the video.

  • @skrypt2664
    @skrypt2664 6 ปีที่แล้ว +1

    Haha, that sound effect made my day! :D

  • @clarencebustillo2182
    @clarencebustillo2182 6 ปีที่แล้ว +1

    Your thumbmail looks like the game Besiege!

    • @RupeeRhod
      @RupeeRhod 3 ปีที่แล้ว

      That's because it's literally a screenshot from the trailer.

  • @mahanfarahani698
    @mahanfarahani698 4 ปีที่แล้ว +1

    i have a question
    when we use cinemachine our player(or character) bound to camera and when we use these code, our camera dont shake. how could i fix it.please help me

  • @androvictrayo-dy7eh
    @androvictrayo-dy7eh 10 หลายเดือนก่อน

    This is a very epic tutorial, now I can create camera shake easily 👍👍👍

  • @pablovm4073
    @pablovm4073 6 ปีที่แล้ว +18

    I only give you a like because of that awesome Sound Effect :)

  • @eriknastesjo843
    @eriknastesjo843 4 ปีที่แล้ว +1

    Camera Shaker script prevents me from zooming (changing z-value in camera position). Weird thing is that I can't access and disable the script by FindObjectOfType or by make it a public variable in the inspector. It's just not there. Anyone knows a solution?

  • @michaeltorruella188
    @michaeltorruella188 3 ปีที่แล้ว

    I have no idea if this will get an answer or not, but I've implemented this and I get an error. It works, but the compiler says `transform.localPosition assign attempt for 'Main Camera' is not valid. Input localPosition is {-Infinity, -Infinity, -10.000000}. UnityEngine.Transform:set_localPosition(Vector3)`
    Like I said, the camera shake works fine in Unity. But when I build for WebGL and upload to itch.io, whenever the cameraShake gets called I get another error and the game freezes permanently. The other error is `Uncaught TypeError: Failed to execute 'setValueAtTime' on 'AudioParam': The provided float value is non-finite.`
    It seems to have trouble with the camera shake script. Any thoughts on this? I'll try to post my solution if I find one.

  • @AnthonyFassolas
    @AnthonyFassolas 6 ปีที่แล้ว

    THe public CameraShake cameraShake; gives an error 'the type could not be found ' ? I am trying to use this together with your Grenade script from another video to call the shake from that script when the grenade that has been thrown explodes

  • @bordel6121
    @bordel6121 3 ปีที่แล้ว

    We're gonna miss you terribly.

  • @luzmarazul
    @luzmarazul 5 ปีที่แล้ว

    8:50 SFX Approved by the best Minecraft Slime in the world

  • @honeybee6978
    @honeybee6978 4 ปีที่แล้ว

    Thanks for the tutorial. All of your tutorials help me a lot!

  • @tyelork
    @tyelork 6 ปีที่แล้ว

    5/5 on the explosion sound at the end! I'm going to use that for explosions in my game now! "Pbfffff"!! Great video like always Brackey's!!

  • @SpiritsGamingChannel
    @SpiritsGamingChannel 6 ปีที่แล้ว

    Hey Brackeys im having a small problem with the EzCameraShake. The shake seems to work fine but when I restart my scene when the player dies the camera shake is no longer present. "//The single instance of the CameraShake in the current scene. Do not use if you have multiple instances." This line is inside of the CameraShaker script. Is there any sort of work around to this?

    • @joshuawatts9040
      @joshuawatts9040 6 ปีที่แล้ว

      Make sure you only create the object when you first start the game and not again when a level loads(only have the object in the start screen scene), then put a script on it that sets it to Don'tDestroyOnLoad, it will carry that object over to your levels so you won't need to load a new one

  • @khizarasif8148
    @khizarasif8148 6 ปีที่แล้ว +1

    Well, i am learning so much.

  • @anandkrishna590
    @anandkrishna590 6 ปีที่แล้ว +2

    Dat sound effect dough

  • @nickpapadimas9703
    @nickpapadimas9703 4 ปีที่แล้ว +1

    I applied this effect when a ball touches a wall in a 2D project and after the camera shake effect the ball does no longer collide with the wall and can pass right through it. Any idea how to fix?

    • @tssper3488
      @tssper3488 4 ปีที่แล้ว

      If the rigidbody isn't already set, change the 'collision detection' from discrete to any 'continuous', this will mean it will always be looking for colliders every frame unlike discrete. If you've already done this then i don't what else to tell u :(

    • @nickpapadimas9703
      @nickpapadimas9703 4 ปีที่แล้ว

      @@tssper3488 Thanks for the response! I have already tried that but still the same :(

  • @Oxmond
    @Oxmond 4 ปีที่แล้ว +1

    Awesome camera shake tutorial! 👍🤓🧡

  • @turbomixer17
    @turbomixer17 3 ปีที่แล้ว +1

    For those who are struggleing to implement this while camera moves:
    Dont save cameras original position, and instead just return to vector3.zero. That is if your camera is a child to some empty gameobject, and you have camera movement scr on that empty.

    • @GameDevJosh
      @GameDevJosh 3 ปีที่แล้ว +1

      Thank you

    • @turbomixer17
      @turbomixer17 3 ปีที่แล้ว

      @@GameDevJosh No problem m8

    • @turbomixer17
      @turbomixer17 3 ปีที่แล้ว

      @Sicko
      Put camera inside an emptyObject
      If you have cameraScript (Responsible for moving camera) make it so this script moves that emptyObject
      Then if camera shakes it is inside an empty and you dont have to worry about position change
      hope that was clear :)
      if not I may do some quick tutorial on my channel

  • @koferperk
    @koferperk 3 ปีที่แล้ว

    this video helped me with an unrelated cause lol, nice vid!

  • @jayantbarthwal4470
    @jayantbarthwal4470 6 ปีที่แล้ว

    i have applied your camera follow the player script of another video ,and with that script this camera shake is not working,what should i do.

  • @joppemin
    @joppemin 4 ปีที่แล้ว

    bold of you to use a while loop in unity

  • @julias9041
    @julias9041 3 ปีที่แล้ว

    Hi! For some reason my camera moves slightly to the left and doesn't return to originalPos... why might that be?

  • @nanoengine6577
    @nanoengine6577 6 ปีที่แล้ว

    Using Random.insideUnitCircle (returns Vector2 with a random x and y with the value from 0 to 1) instead of getting random value for both x and y is simpler in this case.
    So simply:
    Vector2 shake = Random.insideUnitCircle * magnitude;
    transform.localPosition = new Vector3(shake.x, shake.y, originalPos.z);

  • @Mongolbaawar
    @Mongolbaawar 6 ปีที่แล้ว +1

    i wish you were my friend. I would rather learn from you everyday

  • @Henrix1998
    @Henrix1998 6 ปีที่แล้ว

    If you are into math, you could try making the shake yourself using cos(f*t)*k^-t as a base. k marks how fast the shake will fade out and f frequency

  • @toddchavez5374
    @toddchavez5374 6 ปีที่แล้ว

    That's what I needed, thanks Brackeys!

  • @alexfish7792
    @alexfish7792 6 ปีที่แล้ว

    Great video. I found one problem. Multiple calls to the shake coroutine before it finishes will set originalPos to the current offset position during the interruption (You'll see this when quickly starting the coroutine over and over again before it finishes). You can fix this by setting the originalPos one time outside as a private field or simply ending each shake with Vector3.zero.

  • @SaadTahirVelocity7
    @SaadTahirVelocity7 6 ปีที่แล้ว

    You can also use DoTween camera shake. That's the same thing but more comes with it.

  • @aa-ly9on
    @aa-ly9on 6 ปีที่แล้ว +3

    Why multiply rand(-1, 1) and not just rand(-magnitude, magnitude)? Just curious.

    • @darksecret6050
      @darksecret6050 3 ปีที่แล้ว +1

      Then we don't need to reference the magnitude variable twice, I guess

  • @mr.willson5809
    @mr.willson5809 6 ปีที่แล้ว

    best sound FX EVEEEEEEEEEEER!

  • @EinerMuss
    @EinerMuss 5 ปีที่แล้ว +11

    Asset Store Page of EZ Camera Shake: "Unfortunately, EZ Camera Shake is no longer available.
    This package has been deprecated from the Asset Store. "

    • @tong5622
      @tong5622 5 ปีที่แล้ว +6

      It is open-sourcing on GitHub though ;)

    • @paininmydroid4526
      @paininmydroid4526 4 ปีที่แล้ว +4

      Yes, It's open sourced and here is the link github.com/andersonaddo/EZ-Camera-Shake-Unity

  • @YoutubeChannel-oq6ss
    @YoutubeChannel-oq6ss 4 ปีที่แล้ว

    My camera shake does not work correctly. It does not reset the cameras position and everything happens in one frame. Even better, Ez camera shake is no longer available. PLS HELP!

  • @YimboSlyce
    @YimboSlyce 6 ปีที่แล้ว +1

    when i apply the camera shaker to my 2D camera it makes it so i cant see anything other than the skybox please help?

  • @AngryMedic
    @AngryMedic 6 ปีที่แล้ว +2

    Hey brackeys!
    Can you show us how to make the progressive lightmapper more “better and improved”?

  • @4ykuT90
    @4ykuT90 5 ปีที่แล้ว

    Do you guys suggest that udemy course ? I really want something on blender + unity + monetize but want to be sure this guy is the best for that ?

  • @ahsanashraf5723
    @ahsanashraf5723 6 ปีที่แล้ว +1

    Hey Brackeys! I'm continuously moving my camera along positive Y direction in a 2D game. And when player hits something i shake my camera in the way you have shown in this video via EZCameraShaker but the problem is when it shakes my camera it sets camera's position to the position when my game was started. I don't want that, the camera should stay at the point when the shake was started. How to do that? What i'm doing wrong here?

    • @CandorZofain
      @CandorZofain 6 ปีที่แล้ว +1

      Have the camera as a child of an empty object as shown in the video. The empty object's position should remain (0, 0, 0) except during the shake. So move the camera like you normally do, not the parent object, but have the shake script move the empty object.

  • @gerardrierapuig8729
    @gerardrierapuig8729 4 ปีที่แล้ว

    Excuse me, I applied this script to my game, but the script, instead of shaking the camera, it shakes the gun of my player. I don't know why.

  • @seimoun
    @seimoun 6 ปีที่แล้ว

    my camera rotation is at y -90 and everytime i activate the camera shaker the y value gets set to 0 and it wont change what can i do?

  • @陳建至-r6x
    @陳建至-r6x 6 ปีที่แล้ว

    if i want to write slow camera shake myself,I want to control speed,do you have any resource??

  • @SerrOleg
    @SerrOleg 6 ปีที่แล้ว

    Would this work if my camera is set to follow a target around via script? I'm assuming since it takes a start position and resets it to that start position after the shake is done then it would not work for cameras which are moving via script?

  • @komsununoglu1322
    @komsununoglu1322 6 ปีที่แล้ว +1

    Damn brackeys, you should start a tutorial on Foley! That was a brilliant explosion!!!

  • @TrentSterling
    @TrentSterling 6 ปีที่แล้ว +4

    This camera shake varies depending on your frame rate, and you can only call it once at a time. Guess the asset'll do the job. :-\

    • @herisashehu972
      @herisashehu972 3 ปีที่แล้ว

      he multiplied it with Time.deltaTime , so no it doesnt depend on your framerate.

  • @EmmifyX
    @EmmifyX 3 ปีที่แล้ว

    Just use the animation and animate the camera and trigger(or other like bool) when u explode

  • @TheBoxyBear
    @TheBoxyBear 5 ปีที่แล้ว

    (Note: I only have about a year of C# experience) Since you're using a dedicated elapsed variable to control the number of iterations of the loop, why not use for instead of while?

  • @valeriaochoa9391
    @valeriaochoa9391 6 ปีที่แล้ว

    I suscribed in the moment that i heard that amazing sound effect

  • @dimarichmain
    @dimarichmain 6 ปีที่แล้ว

    Nice SFX!!! Where did you get it? I did'n find it in Asset Store... Can you please give me a link?

  • @JosiahIronclad
    @JosiahIronclad 4 ปีที่แล้ว

    I want the shake to only affect the rotation, but when I set the Pos Influence to 0 and Rot Influence to 1 or even 50, nothing happens. This is for both setting it in the inspector and when calling "ShakeOnce()".
    Any ideas?

  • @ashwanishahrawat4607
    @ashwanishahrawat4607 6 ปีที่แล้ว +1

    i use "radmom point on circle" value for the purpose :)