Hello! I’m a bit of a newbie to Unreal so please bear with me - I was hoping you could help with this tricky issue I’m having please.
After a fight sequence is initiated by interacting with an enemy, the camera will pull back and move to give an overview of the surroundings, by focusing on a location that is calculated by getting the midpoint between the furthest enemy AI and the player. The player should then be moved over to the side of the screen to let the two AIs fight. After this is all set up, the camera can be free again. The locations and camera positions will be dynamic so not something I want to set manually.
What I need is a way to create a locked arena based on where the camera is facing after the initial pull back, to stop the player and AIs from moving off screen. So they should be able to move around in the area the camera is looking at, but be blocked by the edges of the viewport.
One thought I had was to spawn in some planes with collision along what would be the edges of the viewport, then do a 360 raytrace around the player and find the closest point from that. But I can’t find a simple way to get the locations to put the planes in. I guess the “camera frustrum” is what I am looking for, but I can’t find how to add collision to that.
This only needs to be set once at the start of the fight based on where the camera starts - after that the camera will unlock, but the arena should remain as it was determined when the camera first set it.
e.g. Image 1: if the player moves this direction, this is fine as we can raytrace to avoid setting a move point beyond the white box object and out of bounds.
Image 2: The problem is if the move point isn’t blocked by an object and goes off screen. Ideally that red line along the bottom should have collision.
What is the best way to go about doing this? If anyone knows a way or can think of any other solution to achieve this same effect, please let me know. Thanks for the help!