r/UnityAssets • u/zibas • Nov 22 '21
(75.00 USD) Tools/Physics Advanced Buoyancy: Realistic and efficient floating physics simulation. WebGL demo/toy in comments.
1
u/anythingMuchShorter Nov 23 '21
Just think how terrifying an underwater survival game with huge debris fields, large submerged structures and realistic buoyancy could be.
1
u/zibas Nov 23 '21
That would be awesome. A little different, but I originally created this asset for a boat building game: https://www.youtube.com/watch?v=pERCMX8wM3s
1
u/kapalselam Nov 23 '21
Looks awesome.. Does it integrate well with other water assets? For example Lux Water?
I've been using Dynamic Water Physics 2 and it has been top-notch so far between these two. Just curious how your buoyancy solution could be better as an alternative than what I have now.
2
u/zibas Nov 23 '21
Thanks! For flat surfaces, there's no need to integrate, just align the shapes. But as far as reading the wave heights out of a water asset, only (the sadly depricated) playway water is included. So other waters would take some work to copy that example. Seems like doing those integrations should be next on my todo list.
1
u/kapalselam Nov 23 '21
Awesome :) Looking forward to seeing your plugin evolve. The more option in this space is the better.
1
u/lidiamartinez Nov 23 '21
Hi , congrats for your assets! I just released Buoyancy with WaveMaker, so seems like we share some stuff in common. I'm interested in the forces you apply. I'm applying them on the grid positions and calculate volume occupancy, using Jobs everywhere. If you do this, were you able to remove aliasing? Doesn't seem like there is any. I fixed it in the last version.
By the way, I do have a component you add to make objects interact with the water surfaces. That's because people asked for it, to have objects that weren't affected.
Also It works with overlapped colliders in the same RB. It took a while to fix that...
Thanks for the talk!
1
u/zibas Nov 23 '21
Cool! We should form a club (or a support group).
If I understand your question about aliasing right, my solution is to sample the object volume and velocities using a grid that's in local space relative to the object being sampled. So the sample points remain stable as the object moves.
I also have an optional component which allows you to mark objects not to be affected! (or to mark them as wing shaped objects which should receive lift forces).
2
u/lidiamartinez Nov 23 '21
Oh, intresting. Haha. The club will have 4 people, I guess... not too many fighting the good fight.
Well, I calculate a lot of data inside each of those "interactors" on demand from the surface. So I need the components to keep it modular.
That's another solution for the aliasing, yes!... I neverthought about it. Maybe voxelizing objects before starting, too, that'd make the projection into the surface easier. Since Raycasts were not working well (RaycastCommand has problems with multihits, it is documented but doesn't work), I ended up creating my own multihit solution, and finally I removed all and started creating my own native colliders, raycasts... then moved all to raymarching . It took several months of suffering but now it's fast and really smooth... phew. (check it out here, in case you're curious: https://www.youtube.com/watch?v=MSm3bNOtnh4)
Now I'm calculating forces inside jobs, too. I just reduced 30% of the frame FixedUpdate() , moving all that to a job instead of calling Complete() to run "ApplyFroceAtPosition". I'd have to store all those forces in a huge nativearray...Well. Slowly I keep making it better. But it's really cool now playing with all the params.
2
u/zibas Nov 22 '21
Hi!
This asset simulates buoyancy, drafting and lift (underwater wing-like forces) with no per-object setup. Just create an area and throw your rigidbodies with collider in.
I made it in 2015 and gave a talk about the math behind it at Unite:
https://www.youtube.com/watch?v=OOeA0pJ8Y2s
This year I completely rewrote the internals to multi-thread way faster.
Even if you have no interest in the asset, playing with the webgl demo for a few minutes is a good time, I promise:
http://popcannibal.com/watervolume/webgl/