Got it about 75% working so far, this is what i have now:
Grabber_USphereComponent = NewObject<USphereComponent>(GetOwner(), FName("GrabberComponent"));
Grabber_USphereComponent->AttachToComponent(GetAttachParent(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, NAME_None);
Grabber_USphereComponent->SetSphereRadius((float)Grabber_Shape_Radius);
Grabber_USphereComponent->SetRelativeLocation(Grabber_PositionOffset);
Grabber_USphereComponent->SetRelativeRotation(Grabber_AngleOffset);
GetOwner()->AddInstanceComponent(Grabber_USphereComponent); // Add to SerializedComponents array so it gets saved
Grabber_USphereComponent->OnComponentCreated(); // Fire off the event that a Component was created
Grabber_USphereComponent->RegisterComponent(); // Register the Component so that it is active in game code
Grabber_USphereComponent->OnComponentBeginOverlap.AddDynamic(this, &UCustVR_MyGrabber::Grabber_OnBeginOverlap); // Overlap events :D
Grabber_USphereComponent->OnComponentEndOverlap.AddDynamic(this, &UCustVR_MyGrabber::Grabber_OnEndOverlap);
Grabber_USphereComponent->SetNotifyRigidBodyCollision(true); // Collision - Simulation Generates Hit Events boolean
Grabber_USphereComponent->bGenerateOverlapEvents = true; // Collision - Generate Overlap Events boolean
Grabber_USphereComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics); // Collision - Collision Presets - Collision Enabled
Grabber_USphereComponent->SetCollisionResponseToChannel(ECC_PhysicsBody, ECR_Overlap); // Collision - Collision Presets - Set all Collision Responses to Overlap (? not sure what the ECC_PhysicsBody does since in editor it shows up as set too WorldDynamic)
#if WITH_EDITOR
GetOwner()->RerunConstructionScripts();
#endif
UE_LOG(LogTemp, Warning, TEXT("Grabber created woopwoop!"));
(line 7-9 came from EniGmaa’s code and solved the USphereComponent creation problem wooh! Thanks again man!)
The problem is that im only getting overlap ‘delegates’/events on running the above code, ie; when the USphereComponent gets created it fires the Grabber_OnBeginOverlap ‘delegate’/event for whatever is overlapping the sphere (before im even getting the “Grabber created …” log message i get the log message set up inside Grabber_OnBeginOverlap for each overlap) but after that, it doesn’t fire anymore when i move the sphere to end overlap / begin new overlap.
I’ve tried the earlier mentioned Grabber_USphereComponent->UpdateOverlaps function on tick (once the component is created) but that doesn’t seem to change anything (and kinda defeats the purpose of events if that’s how its expected to work?)
Im going over the docs & every recent post/question related to overlap events again, checking if i missed something, but if anybody has any tips that be great
Edit:
Turns out that this bit of code was doing more harm then good:
#if WITH_EDITOR
GetOwner()->RerunConstructionScripts();
#endif
Remove it from the above snippet and it works
Thanks all!!