Get the velocity of an actor (or a pawn) when hitting a surface

Hi,

I have a simple ball mesh which is a pawn (or an actor… actually, I tried the two and I’m not sure of what is the best) that I can control with some Add Impulse nodes. I’d like that when the ball hits a surface with a certain velocity, it takes damage or triggers a game over. I think we can do something something like this for a character class :

But problem is that I don’t have the Event On Landed node in a pawn or an actor class. I would also set my ball as a character class but it seems that the Event On Landed doesn’t work as expected. Almost does not work at all, actually… Is there a way to do what I am looking for for an actor or a pawn class ?

I’m thinking about “Event Hit” maybe but I’m not sure. There is many surfaces in my game so if I should cast all the surfaces of all my assets in the ball BP or create a Event Hit on all my assets, it would be much tedious than with On Landed…

Ok, I have done this very basic setup for my ball actor. I have also checked “Simulation Generates Hit Events” into the Collision pannel of my Static Mesh Component. But it does not work. The print string does not appear when the ball hits a surface. Though, it works without the Get Velocity. So the issue is with the Get Velocity but I don’t know what…

My bad ! Actually, it works ! But the velocity is always to 0 when hitting a surface. It is perfectly normal. What I need would be more something like a condition which says : If the velocity decreased to 0 in a very short time, it triggers the print string. I should compare the velocity during the frame when it hits a surface and the velocity during the frame juste before. Something like this…

Three quick suggestions… 1. Run a timer caching the last known velocity to a var (saving / updating it as long as its non-zero). 2. Attach a collision box to the ball, so an overlap occurs first allowing you to perform ops before the actual real collision occurs (where velocity will get reset to zero). 3. Similar to before, do a trace in the direction of travel, and as you’re about to collide or hit something, store the velocity.

Thanks for the answer. Always interesting to know. But finally, no need of all of this. The code is pretty simple and it works :

The result : Screen capture - 1287fbc5df49961b76bc8482b5f0e203 - Gyazo

The engine provided everything ! :smiley:

The only thing (but it has nothing to do with the code I’ve just showed) is that the ball does some little skips time to time, even on a perfectly flat ground. Not really annoyed but well… I don’t know why it does this. Apparently, it’s just because the physics never works 100% perfectly. I’m gonna check if there is something to do to fix this but anyway, my main problem is fixed. Good ! :slight_smile: