Simulating CS2 smoke, flashbang, and HE grenade trajectories:
- Initial grenade throw velocity:
$$V_0 = \text{EyeAnglesToVector}(\text{pitch}, \text{yaw}) \times \text{ThrowPower} + \text{PawnVelocity} \times 1.25$$ - Each physics simulation step ($dt = 0.015625\text{s}$):
$$P_{t+1} = P_t + V_t \cdot dt$$
$$V_{t+1} = V_t + (0, 0, -800.0) \cdot dt$$ - On surface collision trace hit:
$$V_{\text{bounce}} = (V_t - 2(V_t \cdot N)N) \times 0.45$$
Rendering the resulting 3D polyline with ImDrawList::AddPolyline displays the exact landing zone before releasing mouse button!