force::twist
Applies a twisting force around a vertical axis through a specified origin point.
Declaration
void force::twist(float3 origin, float strength, float attraction)Parameters
- origin:
The 3D point in world space around which the twist force is centered.
- strength:
The magnitude of the tangential (rotational) force. Higher values create stronger rotation.
- attraction:
The magnitude of the radial force. Positive values attract elements toward the origin, while negative values repel elements away from the origin.
Discussion
This function creates a vortex-like effect by applying two force components: a tangential force that causes rotation around the origin, and an optional attractive or repulsive force toward or away from the origin. The twist occurs around a vertical (Y-axis) through the specified origin point.