Jump to content

Sectr Neighbor Loading + Teleport


gustavoarcanjo
Go to solution Solved by gustavoarcanjo,

Recommended Posts

I'm using the Neighbor Loader to load my Sectrs but had some issues when trying to implement Teleport.

 

I want all sectrs and its neighbors to be unloaded on point A and all sectors and neighbors to be loaded on point B.

I guess I managed to do that by disabling the SECTR_Member on my player/neighbor loader, warping my navmesh agent and re-enabling the component.
 

However, I noticed some issues, such as moving my player through portals, the point B initially loaded sectrs are not always unloaded when moving to next rooms. I guess that happens more often when the loading point is inside the bounds of more than one sectr.

Is there a recommended way to implement teleport with the Neighbor Loader?

Link to comment
Share on other sites

  • 2 weeks later...

That I am not entirely sure, I have not seen that done nor attempted something like that myself. 
The only thing I can think of is two things: 
1. either the player is getting destroyed (check to see if its set to do not destroy on load) and maybe that will help keep the information just change the transform. 
2. Somewhere in the code the transform and player position is getting lost when trying to teleport. 

Other than that, I am not to sure. You could potentially ask anyone in the discord server if they have attempted to do something like this as well. 


 

Link to comment
Share on other sites

  • Solution

I couldn't find any help in the discord server, but I eventually found a solution.

 

The trick is to reset the SECTR_Member's First Starting Sector field when I teleport. And I also had to force Sectr to look at the starting Sector again. To do that, I added this method to SECTR_Member:

 

    public void ResetStartSector(SECTR_Sector newStart)
    {
        ForceStartSector = newStart;
        usedStartSector = false;
    }

I didn't have to call anything else because my original code already disabled/enabled the Member, which caused an update on the Sector Membership.

Link to comment
Share on other sites

  • 3 months later...

Hello all!

I'm facing this same issue right now @gustavoarcanjo! I found this thread and I'm trying to implement this solution, but I'm facing some difficulties. Could you explain a bit further how you handle this problem?

I'm not sure where to call this ResetStartSector(SECTR_Sector newStart), nor a good way to get the current sector where the player is. I'm currently calling it in my TeleportPlayer class and using a previously set reference of the StartSector.

The problem is that when I teleport my Player, the Sectors in the old area are unloaded, but the ones in the new area are not loaded.

I checked, in the SECTR_Member._UpdateSectorMembership() function, it is running the initialization part, the:

        else if (PortalDetermined && ForceStartSector && !usedStartSector)

        {

            ForceStartSector.Register(this);

            sectors.Add(ForceStartSector);

            newSectors.Add(ForceStartSector);

            usedStartSector = true;

        }

I think it should be just something I'm overlooking, but right now I'm stuck in this problem, can anyone help me?

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

I was able to resolve this teleport issue deleting the loader from my player and instantiating it after the transform was changed. This way, I didn't have to change any SECTR component! I just needed to set the ForceStartSector in the instance, so I kept a Sectr reference in our Checkpoint.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...