I'm using 4.16.1 Had to add #include "Components/BoxComponent.h" before the #include "PickupActor.generated.h" line in PickupActor.h for this to work. Great tutorials though. They are helping me a lot.
@JayAnAm7 жыл бұрын
Hi and thx. Well, what you can also do is to define the BoxCollision as UShapeComponent then you don't need to include, the internal cast to BoxCollision is done in the implementation when creating the component.
@MPatrickDearman7 жыл бұрын
I'm assuming what you mean is to use "UShapeComponent* BoxCollider;" instead of "UBoxComponent..." This did not work either, unless I misunderstood what you meant.
@JayAnAm7 жыл бұрын
Yes, like this, then you just have to add CoreMinimal.h You can also check my upload here for a Cube that uses this: www.patreon.com/posts/12138285 C++ code for the actor is in the posting's text
@MPatrickDearman7 жыл бұрын
Jay AnAm CoreMinimal is there by default yet declaring BoxCollider as UShapeComoonent still does not work unless it is Included as I had to do with UBoxComponent. It's really aggravating how quickly engine source gets updated and breaks all of these awesome tutorials. Oh well I guess... I'm still learning a lot.
@robertbereza63357 жыл бұрын
Had the same problem, and I also had to include "Engine.h" in order to use GEngine->AddOnScreenDebugMessage()
@pollovaldes4 жыл бұрын
If you are using a recent version of UE4, instead of writing "bGenerateOverlapEvents = true" write "SetGenerateOverlapEvents(true)"
@michaelivanov16054 жыл бұрын
Хороший урок! У кого не работает это "Box->bGenerateOverlapEvents = true;", попробуйте "Box->SetGenerateOverlapEvents(true);".
@FreemanTraceur6 жыл бұрын
For anyone reading this, if you want to copy the signature of overlapbegin (or any other built-in event) you can actually find it from their respective header files included with the unreal dev tools for VS. In this case the header file is, PrimitiveComponent.h , you don't have to include this file in the cpp file. Just open the header file and find the function, copy the signature, there will be a bunch of extra commas separating the variable names from the data types, so you'll have to get rid of those and then just do whatever you want to. This is extremely useful because, the signatures of events and functions may get changed and this way you'll get the required signature.
@tsubarider136 жыл бұрын
Great tutorial dude! Didn't understand how to implement overlap events before I watched this video. Thanks :)
@BauTekIndustries4 жыл бұрын
These videos are great, thanks for putting them together! I'm going through these with UE version 4.24 and there are a couple of changes they must've made that required the following revisions: 1. The 'this->BoxCollider->OnComponentBeginOverlap.AddDynamic' had to be moved to APickupActor::BeginPlay() before Super::BeginPlay() is called 2. I had to add '#include "Engine/Engine.h"' into PickupActor.cpp to access anything in GEngine 3. As other mentioned, had to add '#include "Components/BoxComponent.h"' into PickupActor.h Thanks for putting these tutorials together, looking forward to working through the rest of the series!
@nipunmarak58056 жыл бұрын
I added #include "Cpomponents/UBoxComponent.h" . But still it's not working and showing error C2248: 'UPrimitiveComponent::bGenerateOverlapEvents': cannot access private member declared in class 'UPrimitiveComponent' And I'm using version 4.20.3 What can i do?
@aliang83736 жыл бұрын
i use 'this->BoxCollider->SetGenerateOverlapEvents(true)' to replace;
@nipunmarak58056 жыл бұрын
Great man... It works. Thank you
@corygaga59305 жыл бұрын
@@aliang8373 thank you,I met the same problem,finally found you, otherwise i will give up
@jobchen50196 жыл бұрын
That's great!!!!!!!but I have a question.......why my code is follow your video,【FString pickup = FString::Printf(TEXT("Picked up: %s"), *GetName()); GEngine->AddOnScreenDebugMessage(1, 5, FColor::Red, pickup);】....this is successed for the code.. and when I push "play" and get the object after.....it is not display any "ObjectName string" in viewport ....
@SlumpogMillionaire7 жыл бұрын
Just tried doing this without any tutorials... found out the hard way that you need the UFUNCTION() macro above the declaration for the overlap to work. This drove me nuts for over an hour because not only does the trigger overlap not work without the macro, but it also doesn't give any compile errors or warnings when compiling.
@stompeee7 жыл бұрын
What advantage does creating OnOverlapBegin have, rather than just using OnActorOverlapBegin?
@FreemanTraceur6 жыл бұрын
I know I'm late, but creating OnOverlapBegin allows you to do something specific for specific component overlaps, while the OnActorOverlapBegin will consider the entire actor. It'll work here but not for complex actors, with various components.
@tiptopboy887 жыл бұрын
thanks , plz determine UE4's version of each C++ tutorial.
@JayAnAm7 жыл бұрын
Ok, you are right, will add it. This one is 4.15.
@ReubenAStern4 жыл бұрын
Is it just me or has the Collision been changed as of UE4.24? I think they may have done this to get the chaos thing to work.
@千八歳2 жыл бұрын
Thank you very much from China;
@GameDevBeat6 жыл бұрын
i have used both Unreal and unity and currently my project in unreal with blueprint but i see C# way much more simpler than C++ to do all this... in Unity the collision > and check for tags or what ever
@s-c-iulian7 жыл бұрын
1:31 does it have something like that ? :D
@JayAnAm7 жыл бұрын
Of course, and a good one: docs.unrealengine.com/latest/INT/API/index.html
@andrew.r.lukasik3 жыл бұрын
Thanks!
@bertani61344 жыл бұрын
Amazing!!!!!!!!!!!!
@GPTDavid7 жыл бұрын
Your videos are just fantastic.. You need a lot more subscribers, a lot more likes. Great job!
@JayAnAm7 жыл бұрын
:-) Thank you!
@IJUSTLOVEPC7 жыл бұрын
Hello first of all great vids but i have some questions. First of all why do we make all UStaticMesh, AActor pointers? I know what a pointer is but i have a hard time understanding when to use them in ue4 c++ code. And when we 'AddDynamic(this, &APickUpActor::OnActorBeginOverlap)' Why did we put a ampersand (adress of) operator? I know we use the '&' before out parameters. Example Int32 SizeX, SizeY GetViewPortSize (&SizeX, &SizeY) I Know we get the adress to the int32 so when the method find the viewport size it finds the adress of the int32 and modifes its values instead of creating a copy that gets lost when out of scope. But i do not underatand why we use them in AddDynamic or when to use '&' more than in out parameters?
@JayAnAm7 жыл бұрын
Hi, pointers are used here because we want to hold these objects on the heap, not on the stack. In AddDynamics the OnActorBeginOverlap is a function-pointer, in C# this is done with delegates, that's why you need the address of this method in memory.
@IJUSTLOVEPC7 жыл бұрын
I Think i have got a grasp about why we use pointers. When we do "UStaticMesh* CubeMesh" the "UStaticMesh" is a class itself and instead of copying UStaticMesh class with "UStaticMesh CubeMesh", we just Point to it location in memory so it would be more efficient! Im kind of right, right?
@unrealper62845 жыл бұрын
want to know too
@tulczi7 жыл бұрын
Very nice video! Kind regards for such great explanation.
@JayAnAm7 жыл бұрын
Thx a lot!
@dansuricato68287 жыл бұрын
Hi, I'm wondering ...how could an Actor be NULL?
@JayAnAm7 жыл бұрын
If you declare it as variable but don't create and assign it.
@wayzeranime82107 жыл бұрын
I am always waiting for more from you 😉😉
@JayAnAm7 жыл бұрын
:-) thx a lot, like my videos if you do and if you have any special wishes let me know.
@wayzeranime82107 жыл бұрын
Jay AnAm OK I will start my first game i the next it is an endless runner game do you mind if you explain better the random terrain generation and the work of the nodes included or just make it in c++ , thanks 😉😉😀.