Limit relative movment to Box Collision

I am making a top down rail shooter and I have a player pawn set to move along a spline.
The player pawn has a box collision and a child actor.
I have a input axis for both moving the child actor forward, Backward, Left, and right. Relatively.
I dont want the child actor to be able to move outside of this box collision
(The box collision is a component of the player pawn)

Here is the blueprints for moving the child actor relatively.

And here is a list of the components, and the viewport

Although it’s possible to keep the child inside the box with code, why not just make four boxes outside the current one and set them to ‘block all’? That way, the child can move freely with normal code until it hits one of the edges…

I think GetBoundingBox would be useful on the component. If they try to set X or Y coords outside the box, just correct them to the edge of the box…

I did think about that but I will have enemies all around that the player has to use the child actor to kill (Similar to the game Blackhawk Striker) but if all of the boxes are block all I don’t want it to interfere with any of the enemies.

Sorry for being late but I did end up using a custom collision channel for this and that solved my problem

Well, you could use a custom collision class, but I agree it’s easier to do that math… :slight_smile: