Working on a game where players can place blocks around on the screen, right now I’m trying to create a “validator block” that gets placed where the block should, checks to see if it’s overlapping anything, then moves accordingly so that it’s not overlapping anything before placing the block.
The validator block is just a cube with 6 collision boxes as children, 1 for each face.
(North, South, East, West, Top, Bottom)
If one of the collision boxes is overlapping another actor, it assigns it to an actor variable that’s used to determine if there is an overlap, and what direction to move.
My problem: The Bottom collision box only detects collisions if the player’s Z coordinate is higher than the validator’s Z coordinate, and the South collision box only detects the collisions if the players X coordinate is higher than the validator’s X coordinate.
I’m completely stumped on this, I’ve spent the last few days going over all my blueprints and settings trying to find something, at no point do I have the player’s X and Z coordinates connected to the collision boxes or assigning the variables associated with them.
After playing around with a bunch of Print nodes, I found that for some reason, the End Overlap(South) and End Overlap(Bottom) are being called even when they’re still overlapping a valid object.
But I don’t understand why it’s doing this, or why it’s only affecting the South and Bottom collisions?
And it may be irrelevant in your setup - hard to tell from the descriptions whether this could apply.
create a “validator block” that gets placed where the block should, checks to see if it’s overlapping anything, then moves accordingly so that it’s not overlapping anything before placing the block. […] The validator block is just a cube with 6 collision boxes as children, 1 for each face.
However, it also does sound somewhat over-engineered tbh (unless there’s more functionality you’ve yet to mention, ofc). Would you consider / try this:
Instead of a dedicated validator actor.
After playing around with a bunch of Print nodes, I found that for some reason, the End Overlap(South) and End Overlap(Bottom) are being called even when they’re still overlapping a valid object.
You can visualise collisions run-time - does it give any clues whatsoever?
My blueprint for the validator uses the begin collision node to assign the overlapping object to the variable, and the end overlap to clear the variable (sets it to a blank/empty value). But from what I’ve found after playing around with it some more, is that End Overlap keeps getting called for the Bottom and South collision boxes immediately after the variable is assigned, even though it’s still overlapping the object. Except in the cases I mentioned above. But I don’t know why.
For now though, the fix I’ve found is to not use the End Overlap nodes, and to just clear the variable after moving the validator.
I don’t think that’ll work for what I’m doing, basically an example of what the function of the validator is:
if something is colliding with the validator on it’s North side, then move the validator South by
(North Collision Object’s X - Block Size)
Unless it’s also colliding with something on it’s South side, then the validator determines if it should move Up or Down by (Collision Z +/- Block Size), or East or West by (Collision Y - Block Size), based on the Player’s position relative to the validator, and whether or not the validator is colliding with anything above, below, to the East, or to the West of it. This seemed like the simplest way I could find of doing that.