Jump to content
• Advertisement

# Boat Physics

This topic is 5458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I searched the forums and there are limited boat physics threads with information I'm after. I basically want to write a small physics and graphics demo that simulates a powerboat (controlled by user) over an infinite ocean which can change from calm to stormy waters. However, I need to write the physics, and the method I'm using at the moment has some issues. I want it so the powerboat moves pretty much like one in real-life, that is when it goes over a wave, the nose of the boat then comes down causing a splash. I also would like to write it, so that in extremely stormy waters the boat may fly off one wave and then pierce the next and go underwater. However the buoyancy method and way of describing the boat may be flawed. I'm using the way described at the bottom of the page: http://www.gamasutra.com/gdce/2001/jensen/jensen_02.htm The hull is describd by a collection of 'patches' that have a position, normal and the size of the area they represent. Then when that patch goes underwater the volume it displaces is simply the area of the patch multiplied by the distance below the water surface, and altered by the normal to alter the volume depending if the patch is at an angle. However, this method means that if the boat goes fully underwater then the volume displaced is still calculated to the surface when in fact it should be to the point on the boat vertically above it. I'm not sure how to go about this, so it works at whatever depth and boat orientation. One way I've thought about is to fire a ray vertically upwards and check it against the other hull patches to see if it hits any before the water surface, then use that distance to calculate the volume. However that seems overkill doesn't it? Basically has anyone done any serious boat physics, where the object may be fully and/or partially submerged? How did you calculate the volume displaced by the boat against the water (even trickier with wavy seas). If anyone has any ideas or pointers, or any links to some boat physics demos (I cant find any really) then I'd appreciate it. At the very least we could get a decent boat physics discussion going that could be applicable to jet-ski's to speedboats to oil tankers... Thanks!!

#### Share this post

##### Share on other sites
Advertisement
have you looked the meqon demo ?
it has a really nice water simulation with objects floating around very realisticaly
http://www.meqon.com/downloadarea/meqon-demos-1.4.zip
but no source

#### Share this post

##### Share on other sites
Maybe you could find this useful :

http://www-atm.physics.ox.ac.uk/rowing/physics/

About the volume displaced by your object, I think you could approximate this. Your object can be considered like a box. Check for intersections between your box and your water surface. If a triangle is inside your box, you can extract an approximation of the volume by multiplying the triangle area with the distance to one of the plane : project the inverted triangle normal on the box, and get the distance to the plane which intersects with this line. This shouldn't be too expensive as you work with a small set of triangles, most of them are discarded by the intersections tests, this is open to many improvements.

#### Share this post

##### Share on other sites
Yeah I've looked at Meqon. Their floating objects are excellent I think.

As for using a box, I was really after a more accurate way that allowed me to describe the shape of the hull with patches, triangles etc. As opposed to just using a box for the buoyancy. I want to use something that represents the shape of the hull better so I can simulate things like drag and lift better as well as the more accurate buoyancy. Thanks for the reply though.

#### Share this post

##### Share on other sites
For buoyancy you could distribute spheres around the volume of the hull; by checking the depth below the surface of each sphere you can get a fairly OK approximation. You need to realise that since the water surface isn't flat it'll be very very hard to get accurate submerged data - I think a very simmple method would work OK. Maybe try something simple first?

For hydrodynamics you could have a very simple model of the boat and some kinfd of particle system maybe?

#### Share this post

##### Share on other sites
Okay, what I'm going to do is create the hull out of triangles in the form of a low polygon mesh that represents the hull shape. The area of each triangle will be calculated as a pre-processing step.

When it comes to calculating the volume displaced, I will do the following for each triangle

1. Check that triangle centre is underwater.

2. If so, fire a ray vertically up against all other mesh triangles upto a maximum distance which is the water level.

3. Collisions can be optimised by ruling out triangles where normal.y is pointing down for the other triangles being tested

4. If it does collide with a triangle before the water level, then use this distance to estimate the volume.

This will be fast enough for simulating one boat and fairly accurate in the volume calculations. It will also allow the boat to go completely underwater and not displace excess volume (e.g. entire volume to water level instead of top of boat).

What do you guys think? Any obvious flaws?

#### Share this post

##### Share on other sites

• Advertisement
• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• ### Popular Now

• 18
• 13
• 14
• 43
• 63
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!