I’ve seen Andrew Hurley’s tutorials for creating water volumes, and I understand them. But I’m trying to create a re-usable water volume Blueprint that I can place all throughout my game with consistent looks and behavior. So I set out to make a Blueprint.
I’m a bit stumped, though, about how to do what I need to do. What I did was this: I created a new Blueprint class with a Static Mesh component, PostProcess component, and a Volume component.
First, I was able to toggle the PostProcess using the PostProcess/SetEnabled function when the player overlaps the Volume. I’ll need to figure out how to toggle it based on camera collision instead of player collision, but that’s something I think I can figure out.
Next, I set out to figure out how to add the water behavior to my generic Volume, since there is no way to add a PhysicsVolume component to a Blueprint. I found the SetWaterVolume function, but I’m unable to get it to work on my Volume - casting the Volume to a Physics Volume didn’t work (the cast fails). Anyone have an idea of how to give it the proper water characteristics, since those characteristics are built in to the Physics Volumes?
In case your still interested, you cant cast straight from a volume to a physics volume as the physics volume extends volume. I wouldn’t use the set enabled to trigger the post process on and off as it is already built in to the component. So what I ended up doing was very similar to you but two things on top of that after researching the Physics Volume a bit more.
- If you hover over the PostProcess Component in the blueprint it says that it “Will use a parent Scene Component to provide volume data if available.” This is true (which is awesome) but you need to make sure you un check the “unbound” setting in the post process itself and apply it to a parent as the tooltip instructs, I used a box collision instead. This makes it work identically to the physics volume in terms of using the camera instead of player on overlap.
- So the physics volume seemed pretty heavily tied to the MovementComponent. In fact the players movement component has a function to get Physics Volume. From there you can edit it just like you would a BSP style Physics Volume. Just make sure you set everything back when ending the overlap and now you have a stand alone water Blueprint.
Hope that helps clear it up for others wanting to take advantage of the awesome Water Planes provided for free to us!
To expand on yesNinja’s answer, on overlapping the box collision you’ll want to get the player’s CharacterMovement and set it’s WaterVolume to true, as well as set the Movement Mode to Swimming,
This doesn’t work for multiplayer. As soon as one player gets out of the volume, all other players in the volume go to “non-swimming” status aswell.
Do you know how to prevent this from happening please?
Sry, it has been to long ago. I don’t even know if I solved this at all. But maybe with remote procedure calls (Server, Multicast)