Boat physics questions #746
Replies: 4 comments
-
The drag model is currently pretty simplistic. Unlike the buoyancy calculations, it doesn't actually take the submerged volume into account, it only uses the area of the bounding box projected on the velocity in the water. This was good enough for the boat in Horizon Forbidden West: https://youtu.be/EwSvhCO8rEE?feature=shared&t=2757 Since the area scales quadratically, and the boat is usually a lot longer than it is wide, you should already have a lot more sideways drag than forward drag. Maybe you can check what the bounding box looks like? From your videos it looks like the drag is pretty low so you can also experiment with making the engine more powerful and upping the drag in general. In any case I wouldn't be against changing inLinearDrag into a Vec3 so that you can specify the drag per axis in local space. If you want you can make a PR for that.
I haven't been involved much in that, but I think we mainly spawn a lot of particles from the engine and change the water surface texture under the boat to have foam. If I had to make something myself I would probably start with a simple solution like defining a number of points along the normal water line of the boat and track them as they go in and out of the water plane. If they go in at a decent speed -> spawn splash. |
Beta Was this translation helpful? Give feedback.
-
Thanks for reply, will investigate. |
Beta Was this translation helpful? Give feedback.
-
For detecting objects entering the water and spawning splashes, I could use a bunch of points distributed over the surface of an object, as you mentioned. |
Beta Was this translation helpful? Give feedback.
-
There's the Shape::CollidePoint function (which only works on closed shapes), but the best way is probably to do ray casts. |
Beta Was this translation helpful? Give feedback.
-
Hi Jorrit,
I'm starting to work on a controllable boat in Substrata.
See https://www.youtube.com/watch?v=8JJ1MB6AVDo
and https://www.youtube.com/watch?v=e8I_1DJY_TI
for a demo.
I'm using ApplyBuoyancyImpulse() for the boat.
Regarding the linear drag argument to ApplyBuoyancyImpulse - in the boat case the boat should have not very much drag in the forwards direction, and a lot more drag in the lateral/sideways direction.
Maybe the linear drag parameter can be made into some kind of tensor, or a just different components for forwards/lateral/vertical drag?
In the second video you can see the problem: https://www.youtube.com/watch?v=e8I_1DJY_TI
The boat can drift/slide sideways due to having to set the linear drag quite low.
If you don't want to change the ApplyBuoyancyImpulse interface I can try and compute the drag myself, although the problem there is that only the submerged portion of the object should affect the drag computation.
The other main question is about generating splashes, which are definitely needed for realism and feedback to the user that the boat is interacting with the water.
Do you have any ideas on how to generate splashes in a kind of physics-based way? Some kind of collision callback?
Cheers,
Nick C.
Beta Was this translation helpful? Give feedback.
All reactions