Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ApplyWind

Apply wind forces to this shape. Force is computed by Box2D using the shape's projected area, the wind velocity ( _force ) and the drag/lift coefficients in input; circles ignore lift. Forces are continuous (not impulses), so this is expected to be called every simulation step. The shape's owning 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 13 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

ApplyWind(WindInput)

Apply wind forces to this shape. Force is computed by Box2D using the shape's projected area, the wind velocity (_force) and the drag/lift coefficients in
input
; circles ignore lift. Forces are continuous (not impulses), so this is expected to be called every simulation step. The shape's owning 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.
public void ApplyWind(PhysicsBody.WindInput input)

Parameters

The wind configuration. See PhysicsBody.WindInput.

ApplyWind(WindInput, ReadOnlySpan<PhysicsShape>)

Apply wind forces to every shape in
shapes
. The same PhysicsBody.WindInput is applied to all listed shapes. Each shape's owning body must be PhysicsBody.BodyType.Dynamic; shapes on non-dynamic or invalid bodies log a warning and are skipped. Only the listed shapes contribute to wind on their owning bodies; sibling shapes not in
shapes
are left alone - this is the difference from PhysicsBody.ApplyWind, which processes every shape on each listed body. Forces are continuous (not impulses), so this is expected to be called every simulation step.
public static void ApplyWind(PhysicsBody.WindInput input, ReadOnlySpan<PhysicsShape> shapes)

Parameters

The wind configuration. See PhysicsBody.WindInput.

The shapes that wind should be applied to.