I have an open world type of building. I want to set up a trigger on floor 1 that will load the Basement upon entering it to head downstairs. I also want it to unload the Basement when I go through the door upstairs. But I want it all to be on the same trigger. And I need this to work on multiple stair case systems I have going from floor to floor.
The easiest way to implement this while keeping your sanity in check would probably be to have a trigger blueprint that uses the difference in positions.
I would highly recommend adding an arrow component so you can tell which way the trigger box is facing when placing it.
This evaluates to true if in front, false if behind.
Keep the X & Y of the trigger box rotation 0. This does not work as intended with crazy rotations.
We simply find the rotation from the trigger box to the player, account for our own rotation (so we can change the Z rotation of the trigger box), and check if that angle is between -90 & 90 (0 would be facing forward, so -90 to 90 is all that’s in front of it)
It’s up to you to decide if you want to load when in front or load when behind (though I would recommend having it load whatever it’s facing), but you have to keep it consistent.
This is perfect. I am very new to UE and haven’t done a lot of visual coding. I was orignally trying this project in Unity and did a lot of C# coding and was able to get the trigger loading and unloading working. But since this will end up being a VR project Unity wasn’t able to handle this very well.
I will work on the implementation and see how it goes. Thanks for the help
It took a little while but I finally got the trigger system to work as intended. I even was able to add a variable to the load and unload that allows me to use the Details panel to pick which level goes where. Thanks again for the help
What is the base blueprint that you would use to get the collision component? I started with the base blueprint but it doesn’t have the collision component by default. It only has the default scene root. As well as not being able to add the sprite component.
The base is a trigger box
Thanks. I was struggling to figure that one out for so long. One more question. The blueprint works amazing except for when I need to rotate it 90 degrees left or right. I am making sure the arrow is facing the direction I want to ensure if I enter the arrow side it loads and if I enter the back side it unloads. However when I rotate it 90 degrees it seems to flip it so that the back is load and the front with the arrow is unload. I have even added a new blueprint that has the arrow rotated 90 degrees but it still has the same issue of loading on the back side and unloading on the front.
The arrow doesn’t do anything- it’s just to see which way the box is pointing as you place it. Purely convenience.
Make sure you’re only adjusting the Z rotation:
I added the print function to see if the statement is turning out to be true or false. But I am having the same issue. No matter which side I am entering at the statement is false.
Here is a video of my trying to run the code along with my blueprint code
This part is what’s causing the issue:
We want to add the yaw of the actor’s rotation rather than use the actor location.
Using rotation from X vector will result in a rotator pointing from world 0,0,0 to the actor. We don’t want this.
Also, you may just want to use a single variable for the load and unload rather than having to specify both.
If you are talking about the rotation from x vector, I don’t know how to change it to Z. This vector auto added when I connected the Get Actor Locationg to the Break Rotator. And I only have the break rotator because when I added the get actor location and the find look at rotation it only had the single return value unlike your screenshot that has the X,Y,Z Vectors all part of the return value availale. Maybe I just don’t know how to properly have those values show up in full like you do or maybe my version changed that? I am in 5.2 if that changes anything.
We don’t want Z either.
We want the Actor Rotation. You’re trying to convert the location to rotation, which you can’t do.
The node normally gives a rotator that you have to break, but you can right click the pin and break it in the same node. This is purely cosmetic- you can just use a break node like you’re currently using.
Ah I see now. I don’t know why it took me so long to understand what you were meaning by the Rotation instead of Location. It seems to be working much better now. Only issue I am running into now is when one part of a level loads for some reason I lose all player control. I am double checking now that I don’t have other player controls in the other levels I am streaming from but besides that I don’t know what the next step for trouble shooting something like that would be.
Could you clarify what you mean by this? Does input just stop being accepted (test with a print statement), or is it just lag?
You might want to make sure your gamemode is using the same controller throughout.
I don’t think it is lag as the frame rate stays at about 120 after it loads. I am using the first person template for the gamemode and the player. I am saving the file right now to go and make sure I don’t have extra players in other levels from when I was first testing the individual level collisions. The world settings seem to be set up right. When I use the first person game mode from the templete it auto filled the rest for me with the right player controller.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.