Negating or ignoring movement from a physics collision

I have a collision between two objects but I would like to have one of the actors either negate or ignore the movement caused by the collision; is this possible?

Hello, Roddy!

In short, yes, this is possible. In your blueprints, you should have an event that is called when objects collide. That event is connected to the result of the collision - perhaps the characters stopping or ‘bouncing’ back. You could put a ‘branch’ between the collision and the result of the collision, and in that branch check that the collision is with the other object. That should allow you to ignore collisions in one direction, and only with one pair of objects.

Good luck,

Jonathan

Hi. Thanks for the response. There is an Event Hit that has a Hit pin that can be expanded with a Break Hit Result but I am not sure how one would branch from the Event Hit exec. What would be linked to the True and False results of the branch?

Let’s say you have Object A and Object B. If they collide, Object B is supposed to keep going without stopping, but Object A is supposed to bounce back or stop.

The branch would check if the collision was between A and B. If ‘false’ is the answer and the objects aren’t A and B, then the results of the Event Hit would be called normally. If ‘true’ is the answer, meaning A and B are colliding, then you would only want to call the results of the Event Hit (presumably some kind of ‘stop’ or ‘bump’ function) on A.

If you want more specific details, could you show me the blueprint you’re working with?

Thanks for the explanation; I have nothing on the Blueprint yet as I am not sure which event I can use to determine if there has been a collision between A and B. The only event I can find is the Hit Event which seems to be too late from the explanation above. The explanation requires the ability to determine a collision prior to the Hit Event which I am unable to locate.

I think I am missing something fundamental within your answer, apologies.

Okay, so I did a bit more research and this will be harder than I thought. It turns out you *can’t *just have one object ignore the collision, not directly. But the result you’re going for should still be possible. Can you tell me more about the scenario you’re envisioning? We can figure out a workaround to make this happen.

Thanks again for getting back to me (apologies for the delay each time but I am in Australia). I have a ball hitting a bat that causes the bat to tilt backwards slightly each time until the ball ends up going over the top of the bat. I am trying to ensure that the bat can either not be moved by the impact of the ball (I have tried adding large mass and increasing dampening but it has little effect) or I can get the change caused by the impact and reverse it.

Hey, man, no worries. I know how timezones can be, trust me.

Have you tried messing around with Physical Material Overrides under Collision? You might be able to find a combination of Physical Materials for the ball and bat that fixes your problem.

Reversing the change of the impact is probably what I would have done, too. It gets the idea across, anyway.

Thanks for your understanding; I really want to be able to determine the outcome and interaction with the physics engine.
I have tried over-riding the materials but to either little effect or the ball just rolls over the top of the bat without collision occurring.
I tried to get the impact normals (picture attached) but really not sure how to proceed.

Okay, I went and talked to some guys. It sounds like they both favor a non-physics approach, such as turning Simulate Physics off for the bat. That’ll do what you’re looking for, even if it’s a little less ‘realistic’. That means you’ll have to script the bat’s movement, but it’ll take care of the original problem you posited.

I am already scripting the bat movement, so no worries there. I am only using physics to get the Hit Event generated from a collision. The ball passes through the bat when I switch off physics on the bat; if I could get a collision generated without physics that would be much more preferable.

I was thinking about this further and thought that maybe only one side needs to have physics set for the event to be generated. I switched the physics on the ball back on and the ball now is blocked by the bat until it rolls over but a Hit Event is not generated by either the Ball or the Bat.

I have removed the physics options from the bat and ball. I have enabled blocking collisions (screen shots below) but I am now not getting a Hit Event or any kind of collision that I can locate.
From the documentation, a Hit Event seems to only be generated by a physics collision (the Simulation Generates Hit Event option is specified for a physics collision so I have unticked it).
The Bat has a parent type of Pawn and the Ball has a parent type of Actor.
I still seem to be going around in circles :frowning:
Can a collision be generated by non-physics static meshes?

Okay, I’ve been trying to reproduce your situation today and I’ve made some progress.

I’ve got an arm that swings with a bat attached to it that hits a ball away. Physics are off for the bat, on for the ball. In the level blueprint I have Print Strings hooked up for when the bat or the ball have Hit Events. When the ball hits the bat, the Ball fires off a Hit event but the Bat doesn’t.

It’s really strange that you aren’t getting a Hit event for the Ball when it’s, y’know, hit.

Since it sounds like I have what you want, here are my settings.

Thanks again for helping me with this. I have used the above setting and the ball hits the bat, slows down and rolls over it but does not fire a Hit Event. I have been trying other settings to no avail.
If I may, I have put a cut-down copy of the project in the following location:
https://dl.dropboxusercontent.com/u/16976075/Rong%20-%20Copy.zip

All it has are the necessary bits and bobs for the bat and ball; would you be able to quickly hit play and see what is happening? There are a bunch of errors reported for materials I don’t use but while it doesn’t look as nice, the functionality is still there.

Okay, so I went ahead and loaded that file up in 4.2.1 and ran it. I wasn’t sure how you had the bat’s movement working, so I just scripted its movement (moving forward 1 unit as a tick event). When the bat hits the ball (which is also moving by default), they collide, the ball fires a hit event, and bounces off, without impacting the bat’s movement whatsoever.

That was the intention, right?

Yes it is, absolutely. The bat is controlled by the mouse in the player control and not sure why it didn’t transfer across. The only difference is that I wasn’t moving the bat when testing.

Hi,

Thanks for your investigation, the hit event will fire off both are moving; if the bat is still, then the ball rolls over without firing off the hit event.
Does this entail that a hit event only fires off upon a stopping collision as opposed to contact with another object?

Okay, I think I finally understand the problem. The way Pawns and Characters work basically means that they don’t collide when standing still, and DO collide while moving. That’s what is causing your problem, and there isn’t a SUPER easy solution. However, a coworker of mine has a solution! He’s posted it here: Collision not working when standing still? - World Creation - Epic Developer Community Forums

I hope this helps!

Apologies for the delay in responding, really appreciate your help with this.
It does seem an issue that the collision only fires when both objects are moving as the Hit Event provides the location details of a collision. In the attached link it states that this may be looked into, is this the case?
Otherwise it looks like utilising Overlap and bodging up the surrounding functionality :frowning: