Does anyone know how to make it so that when a player steps in a box collision it lowers the players speed?

I also have a sprint system. So I need it to work even when I’m sprinting.

When the player pawn enters the box collision, run a collision event and connect the “Other actor” pin to a cast node that is casting to your pawn class. Then drag out the blue output pin and search for “character movement”. Select a get-node, and from the “get character movement” node, search up and select “Set max walk speed”. Then get a “get max walk speed” node too. Now from here, enter in whatever math you need, and plug the result into the input pin of the set walk speed node. If you want the player speed to be cut by half when sprinting and walking, just divide the previous walk speed by 2, and plug it in. If you want the player to go back to normal speed after they leave the box, just do the same thing (using a on component end overlap event), but inverse the math, so in the case above, multiply the speed by 2 instead of dividing it. Here is an example (Note, that depending on how you’ve set up you’re sprinting system, you might have to adjust this):
UE4Pic003

1 Like

Man thank you SO MUCH. :smiley:

1 Like