Triggerbox is for underwater speed. My character returns to normal speed (or sprints) when I press F underwater. Any way to disable it and enable it again when stepping out?
Hey, you could set up a simple boolean inside your player character blueprint and do the sprinting logic based on the value of that boolean like so
Then make a reusable triggerbox blueprint that disables the CanSprint boolean when inside and re-enables it when out of it
Oh, neat! How do pull out these two things and what are they called?
Thanks
Since you set up a variable called “Can Sprint” inside your character, when you cast to it, you can pull it out by calling “Set Can Sprint”
Strange, I still can sprint while under water. Do I have to set something here?
Full Triggerbox Blueprint. I connected CastToFirstPersonCharacter a second time after set walk speed, if that is okay?
Are you blocking the input of ‘F’ Key with the boolean like in the first picture i posted?
First I had the InputAction
Now I changed it to F
I still can sprint under water (and the print string appears on land too)
Set the default value of CanSprint to true
Here it is on my end
Are you spawning inside of the trigger box?
Checked it. Am spawning outside - no difference
gif’s too small, can’t see what’s happening exactly
Try open it in new tab and ctrl + mouse wheel up (zoom)
Recording a new one in full screen
Edit: I go in the water and press F inside
It seems to be printing the strings correctly… when out of water it says normal sprinting logic and when inside water it says water too dense
Exactly, the prints work fine but the sprint key isn’t disabled. The character also turns back to normal walk speed under water
That’s the point, the print string node “normal sprinting logic” just means that you have to place your sprinting logic here instead of it in order for it to be disabled… the print string is just for showing you how to do it
Basically I can assign a maximum speed to this sprinting logic and cap it to 100?
Oh I see, but it affects land movement.
Land movement has already 400 normal and 800 max speed.
How can I make this work ONLY while being inside the triggerbox? It’s not realistic to return to a normal walk speed or sprint at 800 while underwater.
I wish the given Blueprints would work, but for some strange reason they don’t work explicitly underwater.
Isn’t there a way to assign this right to the Begin/EndOverlap?
BeginOverlap = disable F -
EndOverap = enable F?
Try that out, this will also handle the case when the player holds the sprint button while underwater then goes out.
You can setup the float values however you want, MaxLandSpeed 800, NormalLandSpeed 400, Water Speed 100
Yes my brother!! Quite a net, but it works. Note that I had to remove my basic F sprint speeds for it to work, otherwise I would have slammed my head onto the desk if it didn’t.
Now I’m slowly floating in the water.
Thanks and solved