I’m working on a project where the player character can push a block to an area to jump to higher areas, but the block can only move in the 4 cardinal directions, rather than being pushed diagonally. Because of this, the block is moved manually in it’s Event Graph rather than by simulating physics; I tried that approach earlier but I was having some difficulty locking the axis of its movement. As such, I’d like to manually detect when it’s overlapping with another static mesh (parts of the environment) to lock it’s movement so the player can’t push it into a wall or another object. Because the other object is just a static mesh and is not a component or actor, on component begin overlap does not detect when it collides with this object. Both objects have collision.
Any help is appreciated, thank you!
There’s two typical ways you can approach it
-
Use hit events to detect when one mesh hits another
-
Move a blueprint around instead of a mesh. The blueprint contains one more collision volumes, and you can test for overlaps.
Hi, thank you for the advice!
In terms of your first suggestion, hit events don’t do anything either. I’m not sure why, I’ve set breakpoints for them to try and determine when it gets triggered but it doesn’t happen. In fact, it doesn’t even get triggered when the player runs into the box, so I’m not sure what’s happening there. This is relatively similar to what happens when i try to use overlap, as well.
As for the second suggestions, I apologize, I wasn’t clear in my initial question. I have a separate blueprint for both the player character and the box. When the player gets close to the box and holds a key to push it, the entire cube, collisions and all, is pushed forwards in the direction the player moves. I’ve been trying to use a box collision around the mesh to determine when it’s been running into things, and it works well for detecting when the player character is overlapping it but not as well for when anything else touches it or hits it.
There are 2 tick boxes, Generate Hit events and Generate Overlaps Events. Check if you have enabled both withing your box cube static mesh or collision box, which ever you prefer or works best for you.
That’s what Sweeps are for (among other things).
Note the Sweep
tick box on the node, and on the other end, you receive the entire Hit Result
.
That worked really well, thank you very much!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.