Target Other from Overlap


I’m working in 2D and have sprites moving around my scene using physics.

I have another, static sprite which contains a collision component set to ‘trigger’. In it’s Event graph I am receiving the names of sprites as they overlap it using the ‘ActorBeginOverlap’ event and ‘Other Actor’ reference.

However I’m not sure how to use the ‘Other Actor’ reference to apply a force to any sprite which overlaps.

Any help is appreciated. Thanks.

A force cannot be applied to an actor per se. The things that actually simulate physics are primitive components. So you have to access a primitve component of that actor, and apply a force on that component.

Yes, I have done a lot of scripting in Unity and understand the concept of referencing a primitive component of an object which has overlapped. I’m pretty novice when it comes to UE4 though, I’d appreciate it if you could explain how I would access the physics system of the overlapped sprite?

Ah casting. Thank you very much. Worked a treat.

First you have to cast the actor that the overlap functions returns to the actual class it is. You probably created a blueprint based on a Paper2DSprite or something like that. Cast it to that blueprint. The Cast node has a pin called “as -YourClass-”. Drag off of that and start typing “add force”. It should offer you something like “AddForce (-RenderComponent-)”. You can manipulate the sprite using that. The actual names of -YourClass- and -RenderComponent- will depend on your project.