Overlap Events in C++ - Unreal C++ Course #9

  Рет қаралды 2,089

The Game Dev Cave

The Game Dev Cave

Күн бұрын

Unreal has very good tools for visual scripting with blueprint but of course, there's always those who want to write their code. unreal offers scripting in c++. and while that might sounds like a nightmare, it's not as bad as you think. So come along and let's find out all about C++
Join the discord for any help you need! : / discord
support the channel and development over on patreon : / thegamingcaves

Пікірлер: 9
@StonegazeSteam
@StonegazeSteam 5 ай бұрын
I realized that you need to toggle on "Generate Overlap events" in the collider itself. This little missing detail has been causing me unreasonable pain for over a week. I LIVE for those "Eureka!" moments.
@StonegazeSteam
@StonegazeSteam 5 ай бұрын
13:13 For some reason, I don't get "Collision Sphere" to appear on the editor like it does here. I try to run a "if(CollisionSphere) " as a null-check but get nothing and the overlap delegation doesn't happen.
@thegamedevcave
@thegamedevcave 5 ай бұрын
make sure the variable you make for it in the header file is marked as a UProperty and then in the cpp file inside the constructor you assign it a value with createDefaultSubObject. Then, it's usually best to do a proper recompile of the engine when youve just added a new component like this instead of using live coding too. Live coding can be a little weird with newly added classes or components.
@StonegazeSteam
@StonegazeSteam 5 ай бұрын
@@thegamedevcave I ran it again and it does detect the CollisionSPhere, but no overlap still.
@thegamedevcave
@thegamedevcave 5 ай бұрын
@@StonegazeSteam also make sure that the function you set up to run on overlap is a ufunction. For some reason any function you want to bind to a delegate needs to be a ufunction
@StonegazeSteam
@StonegazeSteam 5 ай бұрын
@@thegamedevcave I still have issues with hit detection. I made another blueprint actor class purely on blueprints and it works fine. But the C++ still baffles me In BeginPlay(), I have CollisionSphere->OnComponentBeginOverlap.AddDynamic(this, &ABaseProjectile::BeginOverLap); void ABaseProjectile::BeginOverLap(UPrimitiveComponent *OverlappedObject, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult) { UNiagaraFunctionLibrary::SpawnSystemAtLocation(this,ImpactParticles, GetActorLocation()); GEngine->AddOnScreenDebugMessage(-1,5.f,FColor::Red,TEXT("HIT")); BulletHit(); Destroy(); }
@Drs.1102
@Drs.1102 10 ай бұрын
Hi, I have followed your tutorial and other tutorials as well, but I keep getting this error, do you have any suggestions? "Cannot convert void(APushCharacterActor::*)(UPrimitiveComponent*, AActor*, UPrimitiveComponent*, signed int, bool, FHitResult&) to parameter type TBaseDynamicDelegate<FNotThreadSafeDelegateMode, void, UPrimitiveComponent*, AActor*, UPrimitiveComponent*, signed int, bool, const FHitResult&>::TMethodPtrResolver<APushCharacterActor>::FMethodPtr (aka void(APushCharacterActor::*)(UPrimitiveComponent*, AActor*, UPrimitiveComponent*, signed int, bool, const FHitResult&)),because source function and target function have different 6th parameter types: FHitResult& and const FHitResult&"
@thegamedevcave
@thegamedevcave 10 ай бұрын
this looks like an error where you're trying to bind a function with the wrong set of paramaters to the delegate. Delegates only take functions with the same paramaters as the delegate is set up for (when the delegate is called, that way it can pass through information) so double check your function's paramaters and see if they match with the ones in the video. Or what's probably better, try to find the unreal engine documentation on this deleagte to see what signature (the paramaters) it takes.
@OrangePanda-epic
@OrangePanda-epic 4 ай бұрын
👍
Apply and Take Damage in C++ - Unreal C++ Course #10
10:28
The Game Dev Cave
Рет қаралды 2,8 М.
Delegates - Unreal C++ Course #15
18:18
The Game Dev Cave
Рет қаралды 8 М.
Thank you 😅
00:15
Nadir Show
Рет қаралды 46 МЛН
Сигма бой не стал морожкой
00:30
КРУТОЙ ПАПА на
Рет қаралды 10 МЛН
10| Pixel art | Watermelon
0:53
TaleKeep
Рет қаралды 188
Beginner Mistakes in Unreal Engine (And How To Avoid Them!)
3:43
CoPilot Virtual Production
Рет қаралды 7 М.
Unreal Engine 4 C++ 4.25 : Threads
29:21
CHADALAK1
Рет қаралды 14 М.
C++ Delegates for Unreal Engine in 5 Minutes!
5:22
Pobato Tutorials
Рет қаралды 3,3 М.
Weapon Pickup in C++ | Unreal Tutorial
16:29
KeySmash Studios
Рет қаралды 6 М.
How to Create a Game in Unreal Engine 5 - UE5 Beginner Tutorial
2:39:04
Unreal Sensei
Рет қаралды 1,1 МЛН
The Unreal Engine Game Framework: From int main() to BeginPlay
27:22
Alex Forsythe
Рет қаралды 228 М.
Unreal Engine Interfaces: Everything you need to know #2 C++ Implementation
14:43
UE4 C++ Inventory : Pickup
10:47
Jayanam
Рет қаралды 14 М.
Thank you 😅
00:15
Nadir Show
Рет қаралды 46 МЛН