Very tricky! projectile to hit actor that doesn't have simulate physics enabled

Hi everyone

This is quite a tricky one and I have noticed multiple people have experienced trouble with this area based on the feature request section.

I’m going to keep this as brief as I can. I’m trying to create an enemy AI, all it does is rotate to face you and fire projectiles. I don’t want this AI to simulate physics because I don’t want the projectiles knocking it back or moving it in any way. I just want it to acknowledge when it’s been hit to reduce health.

For reasons I still don’t understand, Unreal Engine doesn’t allow collisions with actors that don’t have simulate physics enabled. There is only one way around this, which took me hours to find yesterday, which was to replace the DefaultSceneRoot component with the sphere mesh in my projectile blueprint (by dragging the sphere onto the DefaultSceneRoot). Doing this is the only way to have non physics simulating actors register collisions with my projectile to my knowledge, but now I face a new problem.

When I replace the DefaultSceneRoot component with my sphere mesh (as is necessary to make it work), it scales up the mesh drastically, there doesn’t seem to be any combination of ways to address this, I can scale the mesh first, I can scale the DefaultSceneRoot first before replacing it, I can scale them both or just one and not the other, but regardless, as soon as I replace the DefaultSceneRoot with the sphere, the sphere automatically scales up and cannot be changed in the settings, so instead of firing a small energy beam, it looks as if my controller is throwing an exercise ball…

That’s not true at all :stuck_out_tongue:

Physics simulation doesn’t have to be enabled for collisions.

Also I would recommend using the Overlap instead of Blocking logic for bullets. So it’s not a real collision but an overlap, after which you then can trigger the impact FX and destroy the projectile.

Hi MyKonCodes

thanks for your response!

I had attempted an overlap > cast to projectile > print string event last night, but I forgot to set it from “Block” to “overlap” for my custom projectile collision type.

Thank you for saving my project! :smiley:

There is an underlying nuance here that is the root cause of confusion sometimes.

The underlying issues has to do with PhysX itself.
In PhysX, there are 3 types of bodies: Dynamic, Kinematic, and Static.

Due to the implementation which I wont get into here, there are rules regarding collision between these types of bodies.

UE uses a slightly different abstraction, and there are a few settings that affect the underlying PhysX body:

If Simulate Physics is on == Dynamic
If Mobilty is Movable == Kinematic
If Mobility is static == Static

If one or both bodies is Dynamic, then collisions occurs.
If both are static then no collision occurs.
If one is kinematic and the other is Kinematic or Static, then you must move the kinematic with Sweep checked.

Remember, since the only way to move a Kinematic body is by changing its location, you must check the Sweep to receive collisions.

I have been working on a blog post covering this in more detail that I hope to finish and will link to eventually.

Happy Coding

1 Like

Hi OptimisticMonkey

Thank you for your input. It’s nice to know that the issue is being looked at. I’m lucky that my issue was simple enough to be resolved but I imagine for larger projects and for more experienced users, this may pop up as a problem in their work. At any rate I will remove this thread now it has been resolved to clear room for others.

Don’t remove this thread, all threads have the chance of helping someone else out in the future.

Ah ok no problem!

I’ve been messing with various solution to get my projectiles with movement component based movement, and without physics enabled, do collision.

What I did was use a beginoverlap node to trigger my other nodes, and this would only work (as the beginoverlap + button describes when you hover over it with the mouse) when the object the projectile comes in contact with has “generate hit events” enabled. This was the only way I could this stuff working without physics which affects projectile trajectory.

THANK YOU!

Kinematic sweep is exactly what we needed for our non-physics moveable objects.

Now I just need to figure out how to trigger kinematic sweep when the moving object is bound to the socket of a moving parent, or set at the child of a moving parent.

We’re you ever able to resolve this?

It effectively makes hierarchical parenting as well as sockets useless for our application as there appears to be no way to have a child objects inherited movement trigger kinematic hit collisions.

Update: For future Googlers, while UE has the concept of kinematic sweeping when using the SceneComponent > SetWorldLocation or SetWorldTransform functions/nodes, UE does not appear to actually implement sweeping when the components transform is updated from either child/parent hierarchy, or when the child is bound to a parents socket.

The workaround is to have the actors as siblings where the ‘child’ actor has it’s transform set to match that of the ‘parent’ each tick using SceneComponent > SetWorldLocation or SetWorldTransform. This will ensure that kinematic hit collisions are calculated when the collision preset is set to block.

The child collider can/will still get ‘stuck’ on colliders if the parent can pass though. If that behavior isn’t desired, or you want both hit and overlap. You’ll need to change the child collision detection from hit to overlap when the hit occurs, and then change back to hit when the overlap ends.