On Hit Exit?

I am using the Hit event for my marble which dictated whether it can jump or not. When the marble hits the ground, it turns a CanJump bool to true and when the Jump Input is pressed, add an impulse and then return the CanJump to false.

This works, but there is many issues. I have a rolling sound and I only want it to play when it’s on any surface only. So I make it only play when CanJump is true. Here is the problem: The CanJump doesn’t return to false when the marble leaves the ground without jumping. So the rolling sound keeps playing even though the marble is falling. Also, when the marble bounces off a wall, CanJump gets set to true. This allows the sound to play while in mid air, and also allows the player to jump in mid air.

So I thought, In Unity, there was the OnCollisionEnter(); and an OnCollisionExit(); functions. I could use the Enter to set the CanJump to true and the Exit to set CanJump to false. I looked for something similar to the Collision Exit in Blueprints, but unfortunately I could not find one. There is ActorBeginOverlap and ActorEndOverlap. I tried using this, but it couldn’t get the normal direction of the object hit so I could apply the jump impulse in that direction. Also they just didn’t work.

Can someone tell me how I could somehow ‘invert’ the Hit to activate when it isn’t touching anything?

Many thanks!

Maybe take a look at Event Hit.

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Events/index.html#eventhit

You probably want the begin/end overlap event (is that what its called?) instead.