Добавить
Уведомления

Simple fluid dynamics with PhysX in Unreal Engine 4 - Archimedean buoyancy

Attempting to create a generalized solution for simple fluid dynamics in UE4. So far I have introduced the concept of a fluid volume, a physics volume that describes a fluid in my system, having a density and a flow velocity (wind/currents). Using this and the volumn of the rigid bodies being simulated an actor component applies force upwards based on the net weight of the object This isn't very realistic yet because it does not experience fluid drag yet. Regardless, here is how this works: Archimedes described a principle where the net weight (mass under the effect of inertia/gravity) is equal to its weight - the weight of fluid displaced. We know from Newton's laws that a reaction creates a reaction, so an object pushing down on a fluid, displacing it, produces about as much force as the force required to accelerate the displaced fluid via gravity. So: Volume of the body (in UU/centimeters) * density of the fluid in g/cm3 = weight of the fluid in grams. Divide this by 1000 you get the weight in KG, now you can multiply that by the acceleration of gravity (980 UU). example: a 1m3 cube of styrofoam is immersed in water, it displaces 1m3 of water, at 1 g/cm3 so: weight = (1 * 1000000) / 1000 weight == 1000 force of gravity = 1000 * 980 force of gravity == 980000 or, 1 ton of pressure on the bottom of the cube! just apply this force with AddForce upwards on each primitive component. you can get the volume of the body from the bodysetup and the mass from the bodyinstance

Иконка канала  Компьютерный Эпос
5 подписчиков
12+
17 просмотров
2 года назад
12+
17 просмотров
2 года назад

Attempting to create a generalized solution for simple fluid dynamics in UE4. So far I have introduced the concept of a fluid volume, a physics volume that describes a fluid in my system, having a density and a flow velocity (wind/currents). Using this and the volumn of the rigid bodies being simulated an actor component applies force upwards based on the net weight of the object This isn't very realistic yet because it does not experience fluid drag yet. Regardless, here is how this works: Archimedes described a principle where the net weight (mass under the effect of inertia/gravity) is equal to its weight - the weight of fluid displaced. We know from Newton's laws that a reaction creates a reaction, so an object pushing down on a fluid, displacing it, produces about as much force as the force required to accelerate the displaced fluid via gravity. So: Volume of the body (in UU/centimeters) * density of the fluid in g/cm3 = weight of the fluid in grams. Divide this by 1000 you get the weight in KG, now you can multiply that by the acceleration of gravity (980 UU). example: a 1m3 cube of styrofoam is immersed in water, it displaces 1m3 of water, at 1 g/cm3 so: weight = (1 * 1000000) / 1000 weight == 1000 force of gravity = 1000 * 980 force of gravity == 980000 or, 1 ton of pressure on the bottom of the cube! just apply this force with AddForce upwards on each primitive component. you can get the volume of the body from the bodysetup and the mass from the bodyinstance

, чтобы оставлять комментарии