Unity3D - Making Objects Float in an Ocean, and Making Ocean Waves (long version)
After watching someone on Twitter tinker with a ocean waves + buoyancy system, I felt like making one too. (The person on Twitter was https://twitter.com/marmalade_tim - he does some pretty slick modelling and map design for Team Fortress 2. Give him a follow!)
(This is a longer video showing more detail than the other one at https://www.youtube.com/watch?v=F1AmgD058r0.)
WHAT THE SYSTEM CAN DO:
- Objects, when submerged, get forces applied to push them back to the surface. The deeper they are, the more force is applied. Velocity and angular velocity (ie rotation speed) are dampened every frame an object is in the water, to simulate fluid resistance.
- Waves push objects in the direction the wave is travelling, based on wave speed (ie wave frequency), and height of the wave at the given point (higher = more push, lower = less push).
- Waves can have their frequency, amplitude, wavelength, and source point changed dynamically.
- Many waves can be added together for more realistic + chaotic waves like seen in the ocean.
- The boats typically flip back up the right way. There's no hack there, just a very massive rigidbody added below the boat's centre of mass (seems making the rigidbody ~80% of the boat's mass works well for stability without sinking the boat). This simulates what real boats use to remain stable on turbulent waters, as far as my layperson knowledge goes.
Other Videos By nesis
Other Statistics
Team Fortress 2 Statistics For nesis
nesis presently has 37,133 views for Team Fortress 2 across 2 videos, with his channel publishing less than an hour of Team Fortress 2 content. This makes up 1.38% of the content that nesis has uploaded to YouTube.