Tweak air lif/drag coeffs to properly simulate wind on cloth

This commit is contained in:
Wojtek Figat
2023-07-14 17:10:28 +02:00
parent aef3ae14d4
commit 2645b69ec0
2 changed files with 4 additions and 4 deletions

View File

@@ -62,12 +62,12 @@ API_CLASS(Attributes="ActorContextMenu(\"New/Physics/Cloth\"), ActorToolbox(\"Ph
/// <summary>
/// Defines how much drag air applies to the cloth particles. Set to 0 to disable wind.
/// </summary>
API_FIELD(Attributes="Limit(0, 1)") float AirDragCoefficient = 0.0f;
API_FIELD(Attributes="Limit(0, 1)") float AirDragCoefficient = 0.02f;
/// <summary>
/// Defines how much lift air applies to the cloth particles. Set to 0 to disable wind.
/// </summary>
API_FIELD(Attributes="Limit(0, 1)") float AirLiftCoefficient = 0.0f;
API_FIELD(Attributes="Limit(0, 1)") float AirLiftCoefficient = 0.02f;
/// <summary>
/// Defines fluid density of air used for drag and lift calculations.

View File

@@ -3450,8 +3450,8 @@ void PhysicsBackend::SetClothForceSettings(void* cloth, const void* settingsPtr)
clothPhysX->setLinearInertia(PxVec3(settings.LinearInertia));
clothPhysX->setAngularInertia(PxVec3(settings.AngularInertia));
clothPhysX->setCentrifugalInertia(PxVec3(settings.CentrifugalInertia));
clothPhysX->setDragCoefficient(Math::Saturate(settings.AirDragCoefficient));
clothPhysX->setLiftCoefficient(Math::Saturate(settings.AirLiftCoefficient));
clothPhysX->setDragCoefficient(Math::Saturate(settings.AirDragCoefficient) * 0.01f);
clothPhysX->setLiftCoefficient(Math::Saturate(settings.AirLiftCoefficient) * 0.01f);
clothPhysX->setFluidDensity(Math::Max(settings.AirDensity, ZeroTolerance));
auto& clothSettings = Cloths[clothPhysX];
clothSettings.GravityScale = settings.GravityScale;