I’d like to restart the level IF the player’s speed becomes 0.
Basically, if the player runs into an obstacle that prevents them from moving any further,
I want them to start from the beginning of the level.
I know I can set it to restart when a certain speed is reached, but what if I want the restart level event to initiate when the speed becomes 0, from an already 1+ number while moving forward?
There are two ways to do this. If you really want any event in which the player stops moving and are using a character (not a pawn) then you can check for the characters velocity (which is part of the character movement component every character owns). You can get it via the same as well. This… well it represents your velocity. If that is below a certain number you can just say he isn’t moving anymore and restart the level.
However sometimes you might want to just pause the movement for a bit which would trigger this as well. A great solution could be just detecting collisions (from the actor you hit) via an interface. On event hit → if other actor implements interface → kill. Like this you can chose yourself which obstacles actually kill your character.
Well a combination of both of those things are possible as well. On hit call an interface event for your character. Inside of your character you then can check if your velocity is low or even exactly 0 and if that is the case destroy your character.
Or just do the velocity thing. That will certainly work as well. I’m just throwing around with ideas of how it would be possible to do it because I have no idea what exactly your usecase is. Just decide yourself what exactly it should do. If none of my suggestions fits those requirements ask again with a more detailed explanation and I’ll see what I can come up with