Recoil simulation

Just saw this cool video:

Does anyone have any idea what he is using here? Just some random noise on the weapon root bone?

1 Like

Seems like the ?

I’d go with random torque, resulting in compound angular error, and a motor sluggishly pulling the orientation back toward the aim constraint, like a slow spring… but I sense it’s not that random… the right “feel” would include the angular momentum at the moment of firing.

Could you elaborate a little bit on “compound angular error” and “random torque”? By random torque, you mean pushing the model randomly in the horizontal and vertical axis over delta time? Like, model.x = model.x * rand(1, 50) * delta.Time?

I was actually thinking in spherical terms - something akin to arcball rotation, but a 2D version would involve choosing a vector which points away from the target in a direction which is initially random, but which tends in the direction of any existing offset, and with a random (but clamped) magnitude. This vector can be used to compute a new lookat vector, which we lerp toward fairly rapidly, while a spring equation can be used to pull the newly-calculated lookat vector back to point at the target over time.
The concept I had in mind is that initially we choose a random directional error term, but should the player shoot again, the new direction should strongly reflect the existing direction error term - and this whole notion of angular error terms should definitely be clamped to reasonable angular limits…