Hello, I'm a newly-purchased user of this package, and I noticed in your AO Spinning Cylinder Custom Fluid Effector Demo video that it effectively simulates the airflow generated when wind interacts with 3D objects. However, I couldn't find specific instructions or demo files on how to achieve this effect. I would like to inquire if the package provides any methods that can be referenced or if there are any techniques to achieve this effect.
Thank you!
Hi Michele,
Sorry for the confusion here, we've released the flow primitives update since this discussion so it should now be much easier to produce these effects. You can now create a flow primitive and add that to your scene. Flow primitives have the same "VelocityFunction" that fluid zones have. We separated the volume/zone and the flow behaviour into two classes for clarity in their use, this means that a flow primitive will affect everything in a scene unless it is contained inside a Fluid Volume, i.e. it is a child of a game object with that component attached.
An example flow primitive script would look like this:
using UnityEditor; using UnityEngine; namespace AerodynamicObjects.Flow { public class FlowRoundCylinderDemo : FlowPrimitive { public AeroObject cylinder; public float freeStreamVelocity = 1; public override Vector3 VelocityFunction(Vector3 position) { // Get the position relative to the cylinder's position position -= cylinder.transform.position; // Assuming the cylinder is extruded along the z axis for simplicity float radialDistanceSquared = (position.x * position.x) + (position.y * position.y); float radialDistance = Mathf.Sqrt(radialDistanceSquared); float cylinderRadius = 0.5f * cylinder.dimensions.x; // Non-physical, we're inside the cylinder if (radialDistance <= cylinderRadius) { return Vector3.zero; } float cosTheta = position.x / radialDistance; float sinTheta = position.y / radialDistance; float omega = cylinder.rb.angularVelocity.z; float circulation = -omega * cylinderRadius * 2f * Mathf.PI * cylinderRadius; float rr = cylinderRadius * cylinderRadius / (radialDistance * radialDistance); float vr = (freeStreamVelocity - rr) * cosTheta; float vtheta = (-(freeStreamVelocity + rr) * sinTheta) - (circulation / (2f * Mathf.PI * radialDistance)); return new Vector3((vr * cosTheta) - (vtheta * sinTheta), (vr * sinTheta) + (vtheta * cosTheta)); } } }
Please note that I haven't been able to test this - if you have any issues with it please let me know and I'll look into it in more detail.
Best wishes,
Conor