Physics-based Fishing Prototype
A downloadable game for Windows
This is just a small tech-demo
I wanted to test out a pure physics (rigidbody) controlled character against other physical obstacles and environment behaviors such as waves and buoyancy, a rigidbody boat, and joints that are a part of a rod. Below, I'll list a few technologies and algorithms that you may notice in the demo.
Physics-based character controller
I wanted my character to be able to swim on a boat that would also be affected by physics. I've searched for many existing character controllers available in the asset store, but I couldn't find any that would allow for that. Usually, the character would just ignore any external forces applied to him or just couldn't stick to another rigidbody. So I've used and modified a Catlike Coding approach that you can check out here https://catlikecoding.com/unity/tutorials/movement/. It's an awesome resource, really helpful for building your own rigidbody-based character controller.
Gerstner Waves
I've learned about the Gerstner waves and wanted to see them in action, so I've prepared a bit modified version of it to make it work both with the water shader and with physics. In the prototype, you can modify the three waves that are applied, just be careful not to use too big values as things may look bad :D Also, the water shader uses depth sampling, to make it easier to spot how deep below the water's surface an object, i.e. a fish is.
Boids/Flocking simulation
I've implemented a modified version of a boids algorithm and I've made it work with rigidbodies so the fishies would interact with other physics objects, not just pass through them. To make calculations faster, I've made use of the compute shaders. Also apart from the usual coherence, separation, and alignment weights, I've also added target weight, when the fishies will notice that the end of the rope is in the water, random-direction weight (that uses an open-simplex noise), and a few controls that make sure that the fishies will likely stay on a specified depth under the water, rather than going up and down semi-randomly. The fishies use a state machine that handles a few states like the free-roam, the interested-in-bait, and the try-to-flee states.
Open-Simplex noise
I've learned that it's a really cool way to make a character pick a direction and wander randomly, but in a smooth manner. So I'm using it for the fishies in their free-roam state.
Verlet rope
Using the Verlet Integration and line renderer, I've made a visual part of the rod's rope. Under the hood, the rope is just a single Spring Joint.
Buoyancy
Obviously I've implemented buoyancy to make things behave realistically in water B^)
Comments
Log in with itch.io to leave a comment.
trò chơi này thật tuyệt