C++ Collision and Delegates UE4 / Unreal Engine 4 C++

Sdílet
Vložit
  • čas přidán 22. 06. 2019
  • UE4 C++:
    This playlist covers various aspects of working with C++ inside of the Unreal Engine.
    This Video:
    In this video, we cover the process of working with any collision events in Unreal C++. This video specifically looks at BeginOverlap events but the process and logic are the same for any other Overlap or even Hit events.
    Links:
    The beginning of this playlist: bit.ly/CPPOverviewUE4
    Download projects from any complete tutorial series and more: github.com/DevEnabled?tab=rep...
    Consider supporting the channel on Patreon: / devenabled
    My First Pluralsight Course: app.pluralsight.com/library/c...
    My Second Pluralsight Course: www.pluralsight.com/courses/u...
    My Third Pluralsight Course: app.pluralsight.com/library/c...
    Check out my Website: devenabled.com/
    Twitter: / robbcreates
    Sound Effects (BFXR): www.bfxr.net/
    Get Affinity Designer: affinity.serif.com/en-gb/
    Get Unreal: www.unrealengine.com/
    Get Some great free assets here: www.gamedevmarket.net/ Gamedev.tv Courses - Affiliate Links:
    Unreal C++ Developer: www.gamedev.tv/p/unreal-engin...
    Unreal Multiplayer: www.gamedev.tv/p/unrealmultip...
    Unreal Blueprints: www.gamedev.tv/p/unreal-bluep...
    Blender Characters: www.gamedev.tv/p/blender-char...

Komentáře • 57

  • @DevEnabled
    @DevEnabled  Před 5 lety +3

    In this video, we cover the process of working with any collision events in Unreal C++. This video specifically looks at BeginOverlap events but the process and logic are the same for any other Overlap or even Hit events.

    • @kinglogan4029
      @kinglogan4029 Před 2 lety

      You all probably dont give a damn but does any of you know of a tool to get back into an Instagram account??
      I was dumb lost the password. I appreciate any tricks you can give me.

    • @lochlanseth9092
      @lochlanseth9092 Před 2 lety

      @King Logan Instablaster :)

    • @kinglogan4029
      @kinglogan4029 Před 2 lety

      @Lochlan Seth Thanks so much for your reply. I got to the site on google and I'm waiting for the hacking stuff now.
      Takes quite some time so I will get back to you later when my account password hopefully is recovered.

    • @kinglogan4029
      @kinglogan4029 Před 2 lety

      @Lochlan Seth it did the trick and I actually got access to my account again. I am so happy!
      Thanks so much you saved my ass :D

    • @lochlanseth9092
      @lochlanseth9092 Před 2 lety

      @King Logan No problem :)

  • @DeclanCrane
    @DeclanCrane Před 5 lety +2

    Please keep these up man, great as always

  • @marshall7254
    @marshall7254 Před 3 lety +28

    The documentation has been updated and no longer contains the example code / signature referenced in the video, I looked around for another example but I couldn't find one easily so I just copied it out of the video if anyone else wants it:
    OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)

    • @alexheuman3586
      @alexheuman3586 Před 3 lety +6

      It's there docs.unrealengine.com/en-US/ProgrammingAndScripting/ClassCreation/CodeOnly/index.html

    • @aironebush346
      @aironebush346 Před 3 lety

      mvp

    • @dgrins552
      @dgrins552 Před rokem

      legend, thank you!

    • @NJLStudios1
      @NJLStudios1 Před rokem

      @@alexheuman3586 good looks

  • @SeyferStudios
    @SeyferStudios Před 3 lety

    Excellent work!

  • @PrabhjotSingh_
    @PrabhjotSingh_ Před 2 lety

    Thanks for great tutorial

  • @tacca4720
    @tacca4720 Před 3 lety

    Another brilliant tutorial, thank you.

  • @borbling
    @borbling Před 4 lety

    THANK YOU SO MUCH!!!

  • @bulentgercek
    @bulentgercek Před 3 lety +10

    04:13 I can't find anything like this in documentation on the same page. Are they deleted it? What happened to this nice documentation?

    • @alexheuman3586
      @alexheuman3586 Před 3 lety

      It's there buddy in the C++ API. How are you gonna learn how to make games if you can't read and insist on insulting the documentation?

    • @niodyan4476
      @niodyan4476 Před 3 lety +1

      @@alexheuman3586 Look, I got the documentation website and only get this absolute shite: docs.unrealengine.com/en-US/API/Runtime/Engine/Components/UPrimitiveComponent/OnComponentBeginOverlap/index.html

  • @jenniferalderson6875
    @jenniferalderson6875 Před 4 lety +1

    Oh gosh, I've wasted so much time trying to understand why my delegate in constructor doesn't work. Thank you sooooo much!!! Awesome tutorial!

  • @my4127
    @my4127 Před rokem +1

    In AYTCharacterBase::OnOverlapBegin(), you will have a crash when colliding with an interactable object while not focusing on it. Make sure to check that "FocusedActor is equal to OtherActor" before calling Interface->Execute_OnInteract().

  • @dawne2780
    @dawne2780 Před 2 lety +2

    Why can I not find any example code in unreal's docs?

  • @zep_value
    @zep_value Před 2 lety

    I really enjoy the way you explain complex physics ! I have been working as a software dev for a while and it ticks me a bit to find the optimal performance for programs/games. Why aren't we using the onHit since all we need to do is catch the event of the collision and make the grey cube disappear ? isn't the overlap kinda an overkill ? Thanks again for your content :D

    • @DevEnabled
      @DevEnabled  Před 2 lety +1

      Same complexity for different goals. Do you want your object to be physically blocked or stopped and return details? Use Hit. Do you want to just know when two things are in the same space but not necessarily move eachother out of the way, for example a checkpoint, use Overlap.

    • @zep_value
      @zep_value Před 2 lety

      @@DevEnabled Watching your amazing tutorial also cleared that question for me :D czcams.com/video/KQgOqyYoHAs/video.html

  • @unrealdevop
    @unrealdevop Před 4 měsíci

    First of all thanks for the video.
    Secondly I would like to note how much I hate what they have done to the documentation. It's basically 100% useless now. The delegate signature isn't even available from the documentation anymore and I had to find it in the Source Code.

  • @user-mo8kc6vn9y
    @user-mo8kc6vn9y Před 3 lety

    Please tell me how you can do cast without overlapped?

  • @gabrielepardi5178
    @gabrielepardi5178 Před 3 lety

    Thanks: it looks in 4.26 they fixed the issue about constructor.

  • @AdrenResi
    @AdrenResi Před 4 lety +2

    BP_Character's MeshComp should be set to all Overlap
    BP_Character's CapsuleComponent should be set to Ignore Visibility and Block everything else.
    BP_Interactable's Cube should be set to Block Visibility and Overlap everything else. You *don't* need to uncheck the "Do Collision Test" in BP_Character's SpringArmComp when you overlap camera visibility from the interactable cube.
    Can't create delegates (or dynamic code) in the constructor. It must be in BeginPlay.
    When overriding BeginPlay, you need to have Super::BeginPlay or else you can't move the mouse or directional keys.

    • @NJLStudios1
      @NJLStudios1 Před rokem

      This is a valuable comment. Thank you!

  • @6r0m
    @6r0m Před 5 lety

    did you try restart editor for constructor changes take affect?

    • @DevEnabled
      @DevEnabled  Před 5 lety

      I think I have in previous tests and that doesn't always work from the results I remember getting so I've tried providing a fail-safe approach.

    • @6r0m
      @6r0m Před 5 lety

      no problems) thank for the video! but hot reload buggy working with constructors and with some changes in header files, try it for confirm when you have a free time. I'm always restarting editor with these changes otherwise to find why and what - will be very difficult.

  • @LameDuckStudios
    @LameDuckStudios Před 4 lety

    It's not necessary to disable camera collisions. Instead, in the collision channels of the mesh, set the camera channel to ignore. Though I'm curious to why you chose a static mesh over using a box collision component? My understanding is the collision components are cheaper to run.

    • @DevEnabled
      @DevEnabled  Před 4 lety

      A collision update is going to be about the same and the only reason it would be cheaper is that it's not rendering but we have the cube as a visual representation any so rather than stacking up the components I've just used the collision on the cube that's readily available.

    • @LameDuckStudios
      @LameDuckStudios Před 4 lety

      @@DevEnabled Good to know. Thanks.

  • @tommiemartin1596
    @tommiemartin1596 Před rokem

    mesh collision has a slightly different signature than box or sphere collision. That's the part that was throwing me off.

  • @asherscott3151
    @asherscott3151 Před 3 lety +1

    Mine worked without overriding begin play

  • @KUNALSINGH-zk8su
    @KUNALSINGH-zk8su Před 3 lety

    Sir at 9:09 I have done like you but I am getting this error :- error C2039: 'Execute_OnInteraction': is not a member of 'IInteraction_Interface'.......can you tell me why?Thankyou.

  • @tommybazar
    @tommybazar Před 4 lety +1

    The issue in constructors is that you shouldn't add anything dynamic in them. Everything dynamic should go into BeginPlay. I've had this bite me in the ass before - for example - creating Dynamic material instances in constructors won't work etc.

    • @DevEnabled
      @DevEnabled  Před 4 lety

      Yeah, they can be a bit of strange one. It can definitely cause issues storing dynamic variables in them but things like the mesh which you'd already need to have defined in the header should be readily accessible there to reference.

    • @Naeyx
      @Naeyx Před 3 lety

      Thank you thank you thank you! I couldn't figure out why my events weren't firing. I was following the example posted above where they were put in the constructor and it wasn't working. Moved it to begin play and worked!

  • @erikpolygon5471
    @erikpolygon5471 Před 4 lety

    But what if i have about 100 enemys of the same type in the game. Do i have to add my function to every instance of the enemys?

    • @alexheuman3586
      @alexheuman3586 Před 3 lety +1

      Make a class that all the enemies inherit from

  • @nikoszervo
    @nikoszervo Před 2 lety +2

    It seems that it's true that UE's C++ API is a Mess and that the docs can't help you much...Even if you are a C++ dev like me... I'm probably gonna give up and return to Unity, I don't like blueprints at all because I want to write actual code.

    • @DevEnabled
      @DevEnabled  Před 2 lety +1

      Unity can be good too.

    • @leeoiou7295
      @leeoiou7295 Před rokem +2

      exactly. I prefer c++ to c# but unreal will make you hate c++ because of their useless documentation. As for blue-print, I would rather write assembly code than use blueprints. lol.

    • @SiberianSoftware
      @SiberianSoftware Před 5 měsíci +1

      Unreal C++ documentation is indeed very poor with no code samples. You have to fish samples from the videos like this. But I'll not go to Unity, I'll continue to suffer with Unreal code.)

  • @HonsHon
    @HonsHon Před rokem

    looks like they really shafted their documentation recently. They show nothing of this caliber now :(

  • @erikpolygon5471
    @erikpolygon5471 Před 4 lety

    Did they changed the Documentation? Its extremly bad now with absolutly no example and just a very short explenation.

    • @DevEnabled
      @DevEnabled  Před 4 lety

      I think they have been going through updating the documentation. I know they've made the includes much easier to find which is nice. Not sure if they're also simplifying some of the examples for some reason though.

    • @erikpolygon5471
      @erikpolygon5471 Před 4 lety

      Oh, and great Video!

    • @erikpolygon5471
      @erikpolygon5471 Před 4 lety

      @@DevEnabled ok, thank you. I dont really understand delegates or what AddDynamic really does. Do you maybe have a short explanation for me ? (:

    • @IsekaiedxRimuruTx
      @IsekaiedxRimuruTx Před 4 lety +4

      they did really removed all the coding on the docs but only give explanation
      this is really bad , i cant find the code u are referring in the video , so i m stuck
      they update it and make it worst , all coding sample is gone now :(