ApplyWind
Apply wind forces to this body's attached shapes. Forces are continuous (not impulses) and are computed per shape by Box2D using the drag/lift coefficients in input; this method is expected to be called every simulation step while the body is exposed to the wind. The body must be PhysicsBody.BodyType.Dynamic; otherwise a warning is logged and the call is a no-op. Sleeping bodies are woken automatically by Box2D when the per-shape force is non-trivial.
Read time 2 minutesLast updated 14 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
ApplyWind(WindInput)
Apply wind forces to this body's attached shapes. Forces are continuous (not impulses) and are computed per shape by Box2D using the drag/lift coefficients in ; this method is expected to be called every simulation step while the body is exposed to the wind. The body must be PhysicsBody.BodyType.Dynamic; otherwise a warning is logged and the call is a no-op. Sleeping bodies are woken automatically by Box2D when the per-shape force is non-trivial.
inputpublic void ApplyWind(PhysicsBody.WindInput input)
Parameters
The wind configuration. See PhysicsBody.WindInput.
ApplyWind(WindInput, ReadOnlySpan<PhysicsBody>)
Apply wind forces to every body in by iterating each body's attached shapes. The same PhysicsBody.WindInput is applied to all bodies. Each body must be PhysicsBody.BodyType.Dynamic; non-dynamic or invalid bodies log a warning and are skipped. Forces are continuous (not impulses), so this is expected to be called every simulation step.
bodiespublic static void ApplyWind(PhysicsBody.WindInput input, ReadOnlySpan<PhysicsBody> bodies)
Parameters
ApplyWind(PhysicsWorld, PhysicsAABB, WindInput)
Apply wind forces to every dynamic body shape that overlaps in . The same PhysicsBody.WindInput is applied to all overlapping shapes. Shapes whose body is not PhysicsBody.BodyType.Dynamic are silently skipped. Forces are continuous (not impulses), so this is expected to be called every simulation step.
aabbworldpublic static void ApplyWind(PhysicsWorld world, PhysicsAABB aabb, PhysicsBody.WindInput input)
Parameters
The world to query for overlapping shapes.
The world-space axis-aligned box describing the wind volume. Only shapes whose broadphase AABB overlaps this box are processed.
The wind configuration. See PhysicsBody.WindInput.