I’m making a game where you are on a boat and I’m having trouble with the physics. The boat is not drivable but it is moving. The problem is the player character messes with the boats movement and rotation.
If you’re on a boat and its moving in a direction… no matter how hard you try to push it in the opposite direction while being in the boat it wont work. Well in UE4 & UE5 thats exactly what happens. You’re on the boat and if you walk towards the back of the boat, the boat stops moving forward and starts moving backwards if you walk towards the side it spins.
I know there has to be a way to make the physics work correctly. the only thing that complete works is linear and angular dampening but that kills any illusion of being on the water and the boat doesn’t rock and doesn’t move forward. I tried increasing the mass (kg) of the boat, I’ve tried decreasing the mannequin, Both, I’ve tried decreasing the character’s push force, I’ve tried disabling the physics interaction. I’m using UE5 now but I actually have a video from when I first was having the issue (I thought it was the force but its something else that with the physics). Any ideas would be helpful
Hey there @LL0WENT! Welcome back to the community! Generally after you’ve disabled the player’s physics interactions it shouldn’t have any effect on the boat’s physics at all. Just to verify you did disable it in the player’s movement component here?
Thank You for your response, I don’t think it’s the buoyancy exclusively because I faked the rocking by taking off physics for the boat and had the rotation in constant motion to simulate rocking and it had the same affect…it’s almost like if the boat is trying to move in a direction and my character is moving in the opposite direction and my character is overpowering the boat
Throwing a bone out there but is is possible for you to set the up in blue prints the interaction between the characters velocity and the boats velocity does some math to make sure the boat moves with the forward velocity of the character. Maybe on a component overlap you could get the characters velocity divide and apply that velocity to the boat. Only issue is when the character moves to the back of the boat it would also move too. I guess you could technically make sure that on the first contact of the boat it samples the character velocity once and applies it.
I’ve been testing with buoyancy on my side for an hour or so now trying to find a good workaround to use for character movement on it. So even if physics isn’t happening with the character, buoyancy still sweeps in effect so if it collides with the player it. So I thought that since the character itself handles it’s position via trace checks and not raw collision data, it should let the player walk on a child collision set up like this and not effect the boat’s buoyancy calculations. So I set up a child col and gave it a shot and it worked!
It doesn’t have to be a box, you can use a non-visible copy of collision of the boat in yours.
However there are some caveats that make this set up less viable. If your gameplay relies on your player interacting with physics objects inside the water, this next step breaks that a bit. You could make a custom collision for physics objects if you’d prefer to remedy that.
I kinda do.
Whats the point of setting up buoyancy to react to stuff only to then not having it react to stuff?
If the purpose of buoyancy is to simulate a realistic effect of someone weight 200lbs walking on a wooden raft - which it is - and you don’t need that…
Then the whole system can be scrapped and you can run the boat positioning off 4 line traces like every other item ever…
To expand on this. Visivility linetrace probably wont work.
You just run the same wave function in cpp and sample location at gametime to get the height.
It’s a billion times less overhead cost.
Yes It actually worked although the original video was in UE4 and I’m working on UE5 so the new video looks a little different. Trying your method I noticed for some reason I was the boat’s object type whenever it was anything other than “Pawn” I had the issue but changing it “pawn” I didn’t have the issue and the boat drifted as it was suppose to while keeping its buoyancy. (It looks junky cause I messed with so many dampings but I believe this is the fix…thank you
The only solution I was able to find was to set the capsule collision to be spectator. Leave the character mesh collision as character mesh, set my boat collision to block all, and this worked. Im not sure if it matters but I also have “Enable physics interaction” disabled in the character movement with all the settings below it set to -10000.