-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add jet force nodes to enable wind forces on SoftBody #2591
Comments
I would go as far as to say wind should affect all physics objects, not only SoftBodies. I could be a node "DirectionalWind" which affects all the scene (kinda DirectionalLight) and an option for areas to override wind like they can override gravity. Shaders could also get wind info for different effects. |
Ok, this is amazing, I can make puzzles with this . . for instances, attach an object, or make a condition, if parts of cloth is at certain point, open a door . . Wanted to do the same, with a liquid simulation, that made barrels float, as water increases . . . So, make a script, if barrels height greater than, some height, open door . . These simple physics systems can be used, to make amazing puzzles . . . For instance, if cloth blows, and one has a spotlight, as wind increases it blocks the light, and I have a shader, that detects how much light is on a surface, I can make a 'real' light switch . . Even if it's a simple implementation, it can be used to make all kind of puzzles and, systems, that use physics, so this is an amazing add-on, 100 % . . . I hope Godot gets started on making some simple physics stuff, even in beginning one can make fun puzzles, that look ' cool ' and, as they get better, one can make REALLY cool puzzles, with physics elements . . :OO . . For instance, I'm thinking there's a dark room, with curtains, blocks the light . . Player finds a switch, turns on a fan and, the curtains blow away or, so on . . It'll look really cool and, also let light in room, so player can solve puzzles, in room . . . These physics nodes, even if only simple to begin with, can be used for so many things . . . It'd be nice if the wind force could be high enough, to also move low-density rigidbodies . . imo, this is mint and, has a ton of potential . . . <3 |
Ok, I already got an amazing idea, for, I wanted to make a vampire game, with this, I can make puzzle where player opens draft, makes curtain move away, suddenly there's day-light, and main character can fight the vampire . . . The point is, these physics nodes, even if very simple, can be used for MANY cool - things, and it looks even nicer, if running live, with a nice simulation . . . So, 10 / 10, there's probably a TON, of things one can do, maybe use it to simulate sails, on a boat, in 3D . . <3 I hope we get something, like a simple fluid simulation, as well . . Maybe something, that can fill primitives . . Even if it's simple, one can create crazy puzzles, if it has buyoancy, etc . . At first, devs will prob. make simple puzzles, systems . . But, when people get what they can do, sky's the limit, esp. if there was a fluid node, etc . . I see this as an amazing start, of some nodes, physics stuff, that when working together can make amazing things . . 10 / 10, amazing . . . When you make it, engine devs, you just see it as a ' physics node ', but when game devs get it, they'll create all kinds of fun with it, you didn't expect, or so on <3 |
Would this actually apply a force to the thing connected to the body, say in the case of a sail? Or is that left up to the developer (which would be fine)? |
It will actually apply a force. To clarify, there are some other factors at play that I need to consider regarding wind + sail = moving boat, like the coupling of the softbody and the rigid body. I'll think about this some more as I'm implementing it. |
For sure! Glad to see someone is excited about it! We've begun thinking about how to extend this to rigid bodies, and I have some ideas 😏 hehehe |
Just to clarify, the first implementation will only be applied to soft bodies, but the system is designed so that it can be extended to rigid bodies in the future. |
Ok, 10 / 10 <3 can't wait to make some nice game - play moments, with this . . if you provide the physics, then more creative people will use them, to create really nice effects . . . <3 Super - excited for this, hope we get a fluid sim, and a vapor / mist sim . . perhaps, not sure, simple fire sim . . . This is the first step, gonna use this for sure, it's 10 / 10 . . Hope you can find a good implementation, that fits the Godot engine, thx . . . |
Yeah, I think that will be a cool extension. Presently the formulation requires a triangular mesh, but if you can quickly compute the surface area of a physics body from a given perspective, then the same idea can be applied to it |
Implemented by godotengine/godot#51751. |
If I'm reading this conversation correctly, then the three properties documented here apply to soft bodies only, and will later be upgraded to rigid bodies. Is that correct? If so, that would be good to have in the documentation. I just spent about an hour trying to get the wind to apply to a rigid body, then started googling and found this. |
Done: godotengine/godot#90407 |
Describe the project you are working on
This is not for a project I'm working on.
Describe the problem or limitation you are having in your project
Currently, there is no simple way to apply realistic forces like wind to soft bodies.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I propose the implementation of a jet-force object that can be used to specify the origin, direction, and magnitude of a jet force. To visualize what I'm suggesting, check out a video of my implementation for a cloth:
In the simulation I'm running there, I've pinned the top two vertices of a cloth with a ~3k triangle mesh. I then instantiated two jet-force objects: a stronger jet force facing the cloth head on (which is blowing it back) and a weaker jet force facing the cloth at angle (which is making a bunch of extra ripples for demonstration). Although this simulation was done using position-based dynamics--which I might suggest in a later proposal for soft bodies--the formulation for the jet force is pretty much agnostic to the physics model into which it is integrated.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Fundamentally the idea is to specify a jet-force object that interacts with the triangular mesh of soft bodies in its view. The force on a vertex for each incident triangle can be specified by the formula:
where
Fjet
is the jet force,k
is the jet strength,At
is the triangle's area,nt
is the triangle's normal,v
is the direction of the jet force,(c - xc)
is the vector connecting the jet source to the triangle's centroid, andalpha
is an attenuation factor that can be used to account for a force degrading with distance from the source.Currently, the plan is to introduce the wind force through the Area3D node:
In much the same way that one can modify the application of gravity in a specified area, the earlier-mentioned wind force parameters will be available under the Physic Overrides accordion in the inspector panel of an Area3D node:
The parameters that must be specified when using the node interface are:
wind_source: NodePath
to set a Spatial node to set the origin and direction of the windwind_force_magnitude : float
to set the magnitude of wind forcewind_attenuation_factor : float
to set the rate at which the wind dies down over a distanceThe wind force will also be accessible in the API through
PhysicsServer
as a collection of arguments toarea_set_param
:AREA_PARAM_WIND_SOURCE = 10
-- Constant to set/get the source and origin of the wind force in an area as aTransform
AREA_PARAM_WIND_FORCE_MAGNITUDE = 11
-- Constant to set/get the current wind force magnitude of an areaAREA_PARAM_WIND_ATTENUATION_FACTOR =12
-- Constant to set/get the current wind attenuation factor of an areaIf this enhancement will not be used often, can it be worked around with a few lines of script?
I think that it can be worked around, but perhaps not satisfactorily. Consider the video here: https://www.youtube.com/watch?v=4EB9xHmqGFs
Such an approach--and others like it that you can dream up--is not going to accomplish the desired physical simulation. Requiring developers to settle for a workaround like this increases the lead time for development and produces a less satisfactory result.
Is there a reason why this should be core and not an add-on in the asset library?
Including this improvement in core will accomplish two things:
The text was updated successfully, but these errors were encountered: