I am doing a simple test right now for a 2D game I am building in unreal, although I am having some issue with Collision between two of my blueprints so I decided to test the logic in the third person shooter template.
Player Blueprint has the following Hierarchy:
Please make note of the box at the bottom of this list.
I have a sperate Blueprint (in my 2D game this would represent on a ledge at the edge of one of my platforms) it is nothing but a Box Collision.
I have enabled it so that they are both visible in the world, and set both boxes to have block all – however walking into the box blueprint with the player allows the boxes to overlap.
I have added an overlap event with a simple print to determine that they are overlapping, but collision rules are not being applied. I speculate its due to the fact that the box on the character is not the root component, I’m wondering this because the capsule collision that comes with the character is being blocked by the box blueprint i’ve created. I made sure that the settings for the capsule and the child box are the same but still the collision is not detected.
Is this true? Can child collision components not have collision? Is there some way to get the child component (box collision) to not collide with the simple box blueprint i’ve created?
I haven’t added any code to the event graph. I would prefer if the boxes collide by default allowing me to enable / disable its collision from the event graph based on the players movements (jumping for example)
I am open to any suggestions and would be glad to share anymore info if needed.
I will have to try this and get back – although the box collisions i’m working with are dragged directly to scene / root component. Enabling physics – it sounds like – would like take them out of their static space by applying gravity. Am I wrong?
They are two separate things. Simulating physics allows collisions to be handled in a manner consistent with the specified collision profile. You can enable or disable gravity separately.
I found it important in my game to create custom Object Channels, Trace Channels and Collision Presets in the project settings to get exactly what I wanted (e.g. enemies can walk through each other, but not the level or player). I’m not using any physics at all in my game, just collision and overlap checks with appropriate events and simulating movement kinematically.
The idea of collision channels seems to be the most popular answer on the web although I had some issues getting this to work with my project.
Instead of creating custom Channels (since this is just testing) I used the existing ones. I set Box A to be type vehicle with custom collision blocking all and Box B to have custom collision with Blocking for vehicle. Even still the boxes were able to overlap each other.
I have it working right now by manually preventing the overlap with tolerance of few pixels. When the two boxes overlap, I prevent the one controller by the player from moving anymore. The only movement action allowed is for the player to look away – thus triggering the end overlap event which returns movement to the player.