Announcement

Collapse
No announcement yet.

Receiving WorldOriginLocationChanged in C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Receiving WorldOriginLocationChanged in C++

    I've been struggling with something that seems it's likely basic to how you use the engine, but no success.

    We are using Rebasing (via SetNewLevelOrigin) to avoid the problems with precision in a large space world. We aren't using World Comp because there are no tiles per se, it's all flying. The rebasing works amazingly well and eliminated some serious problems, but I have to make adjustments in my waypoint system on each rebasing call, since I used world coordinates that are loaded at game start time and can't be automatically rebased, but can be easily adjusted by my C++ Level Script for any level. I noted that ALevelScript has the event WorldOriginLocationChanged fire when I do a rebasing, but it would be inconvenient to have the Level Blueprint receive this. I'd prefer to have my extended class of ALevelScript do this, because then it's always available in every level if that level that uses rebasing.

    This is likely a noob thing to ask, but how do I have my C++ level script class get registered to receive that event. I've tried overriding the call, but it's not a virtual class, I also tried .Add() and .AddDynamic, but that wouldn't compile, perhaps because of the way I defined my handler function. I wondered if "DECLARE" a delegate might be the ticket, but couldn't find anything to verify this. Is this possible to do and is there a reference to docs on how it's done?

    In short, I'd like one of my ALevelScript C++ functions to be activated when the WorldOriginLocationChanged event fires.

    Thanks in advance.
    Last edited by eagletree; 09-30-2018, 11:17 AM.

    #2
    I gave up on this because I already have the rebasing values since I manually call SetNewWorldOrigin, I had just hoped to use the broadcast done by World.cpp. If anyone else is interested in this, it seems to be what is likely a simple task of becoming a delegate for FCoreDelegate::PostWorldOriginOffset.Broadcast. I tried to set my program up like the other delegates that receive this broadcast, but was unsuccessful and wasn't worth the time since I could manually notify my classes that needed to adjust their offset.

    I still think it would be handy to know how to set ones own class up so it can receive these more obscure engine broadcasts, so if anyone else does this, I'd like to know how. The normal delegate examples seem to focus on doing your own broadcasts (or very common well known ones like ~OnOverlapBegin) and I couldn't make it work for me. This is the second time I've run into wanting to receive what is a useful blueprint event in C++ and been stalled by ignorance.

    Comment

    Working...
    X