Node for detecting if actor is colliding

I am having some difficulty with collisions, I have an actor that i can drag around the screen with the mouse and I need a way to check if it is colliding with something. Currently it seems the only methods of collision detection in blueprint are via event nodes. I need a way to check if the current actor is colliding with anything as a node, not an event, so I can add logic to this. (e.g. if isColling apply red texture else apply green texture).

Additionally my actor won’t trigger onHit or on actor overlap events. I am using the shape_cube starter content mesh in my blueprint as a static mesh component, made sure all the collisions were set up to block all as type world dynamic. And when I move the actor I use set actor transform with the sweep option set to true. Am I missing a step?

On hit will only trigger if you have “Generate Hit events” on which is a check box right above the actual collision sets.

Additionally you will have to make sure that all other actors have in their collision settings overlap or block set under “world dynamic”.

To check for collision you would usually do a line trace (this is a node). You provide a start point and an end point and it will basically draw a line between those two. If it happens to hit something while doing this it will provide a hit result which you can break to get the actor it collided with, where it hit something, what normal it had and a few other things.

I hope this helps.


I know how to do a line trace, but how would I use that check if actor X is colliding with anything? A line trace would only tell me if there is an object in a line from the actor, but that wouldn’t account for the actor’s collision bounds.

Edit: thank you for the collision advice though, I will try that and see if it helps

You can do all different kinds of stuff with it.

If you move it you can beforehand check if there is something and if it should move at all.

Changes like applying a different material are actually better done using events so are most other things which should consider the whole collision body.

I just tried to be as general as possible in case you didn’t know about it and it’d magically solve something :wink:

I would make an integer variable IsColliding default to zero. Make an event handler for OnBeginOverlap and increment IsColliding, and an event handler for OnEndOverlap to decrement it. Then elsewhere in your code you can just check if IsColliding is zero to know if it is overlapping anything at that moment.

This sounds like a really good solution. My question though, doesn’t On Begin Overlap only check for other actors or will it check all collision?

It will check for everything which does overlap with your actor. Keep in mind that both actors (or meshs or whatever) have to have the “Generate overlap events” and have to overlap the group of your actor (with either overlap or block) in the collision settings.

It can be quite fiddly to setup up what exactly will trigger an overlap vs what won’t. So mess around with that to see what works for your use case. Also in your overlap events you can try to cast what it overlapped with and then only inc/dec your counter if it’s run into something you care about and ignore the rest. Just make sure to do the exact same checks in both start and end events!