if i could bypass the gravity vector with my own, this component would have even more applications ![]()
maybe by pairing it with a Area Force 2D component as source gravity
thinking about it now this is much more complicated then i originally thought
if i could bypass the gravity vector with my own, this component would have even more applications ![]()
maybe by pairing it with a Area Force 2D component as source gravity
thinking about it now this is much more complicated then i originally thought
The effector specifying gravity makes things much more complex. Firstly it adds a couple of properties (an option to disable world gravity and one to specify the custom gravity). Secondly, the buoyancy force has to act opposite to the gravity force which means the surface has to be a line perpendicular to that vector. Right now, the surface is a plane that extends, in world-space, along the x-axis to infinity. This makes it fast (for clipping) and simple and covers the common usage case.
Maybe if you can elaborate on the many other applications youāre referring to, there might be ways to do it now or that could be considered for the future. All feedback is most welcome.
EDIT: Iām guessing but if youāre looking for something that pushes an object out of a collider in a controlled direction then the PointEffector2D can do that.
thank you for taking the time ![]()
not many but more than currently available
probably not practical considering performance
buoyancy from any direction is really just fun stuff for level design like
radial buoyancy and curve buoyancy would be pretty cool to play with
maybe sometime after the 2D smartsprite is done
i fully understand that an idea is really nothing compared to implementing an idea
Thereās a bunch of improvements planned for the buoyancy stuff so watch this space!
Would support for dynamic surface ( waves ) be one of these improvements by any chance?
-Jeff
Indeed I would like to get this as an option but it does add a certain complexity to the calculations. The surface would need some strict constraints:
Vector2[] points = { ... };
surfaceEffector.surface = points;
This would allow you to specify an array of points where each point defines an offset along and up/down the surface (see the attached image).
The red arrows define a point offsetting from the surface level to define the surface indicated in yellow. The surface clipping would then be done against the yellow line. Anything outside of the points would just be against the surface level.
Youād be free to change this each fixed-update with no performance overhead as weād not need to perform any complex checking of the points provided as theyāre just offsets from the surface.
This obviously isnāt guarantee of how itād work, really just to open a discussion around it.

This is sounding pretty good, but could you re-explain this:
By outside the points, do you mean to the right or left of the points that have the offsets?
So if a block were āfloatingā on the surface defined by the yellow line, buoyancy forces would only get applied to the parts of the block beneath the yellow line, correct?
If so, this would work perfect for my needs.
-Jeff
BTW, here is what my current game looks like with my custom 2D water system. Would love to swap out the custom stuff for built in unity functionality when itās available.
Yes, anything outside of the points you define (along the X-axis). It could even be an option to only use the X-axis range you specify and ignore any buoyancy beyond that.
Iām also wondering if it would be better to be able to specify the number of points in the X-axis in the effector? We could set the point count, spacing and x-axis offset. This would give you a span of equally spaced points and you would only have to supply an array of Y offsets (array of floats) which provides some added benefits:
Much quicker, less data, no need for sorting the X-axis offsets.
You would be allowed to read/write individual points rather than having to read/write the whole array.
You could have a gizmo that allowed you to drag the points up/down in the scene.
You could have more points than you show on screen and simply adjust the āsurfaceOffsetā to make the surface move left/right (thinking waves moving left/right without having to modify the surface).
Possible to allow āwrappingā of the points provided out to infinity (thinking of a wave surface that repeats infinitely)
// Surface is 100 points, no offset but equally spaced by 0.25 each.
buoyancy.surfaceCount = 100;
buoyancy.surfaceOffset = 0.0f;
buoyancy.surfaceSpacing = 0.25f;
// Access whole surface offset array.
float[100] surfaceOffsets = { ... };
buoyancy.surface = surfaceOffsets ;
// Access individual surface offsets.
for (var i = 0; i < 100; ++i)
buoyancy.setSurfaceOffset (i, surfaceOffset[i]);
// Set the whole surface level up/down.
buoyancy.surfaceLevel = 5.0f;
Nothing is written in stone, feedback welcome.
Iām completely fine with this suggestion. My current setup uses equally spaced points along the X-axis and my wave algorithm simply adjusts them up and down.
I canāt really see a need to have the x-positions non-equally spaced so I think itād be worth the benefits you list.
-Jeff