Check if player is doing a nod or shake with camera.

Hello forum,

I recall there was a really cool script somewhere… and unfortunately I lost my copy a couple of months ago.
The script detected whether the player was performing a nod or head shake with the camera.
Does anyone have an example on how to tackle this or still have a copy of the script in question?

Thanks in advance!

Well, in theory, you need a recording device that is sampling camera movement over time, but only does so for the last n seconds, overwriting anything older. It is capable of tracking two things on the fly: 1) the accumulated (absolute) delta movement per axis, and 2) the point average (to differentiate legit turning from moving around the same directional vector).

The shake (or nod, which is when you exclude one axis) is registered when the average doesn’t move over some threshold, while the accumulated delta is high, but obviously you need to tweak the three variables: 1) the time interval, 2) the delta threshold, and 3) the average tolerance, to make this work.

This sounded incredibly interesting so I thought I’d take a whack at it myself.

Give it a try. Here it is in action:

Full sources at:

It is two scripts, one for yes, one for no, hack it up or twiddle the settings however you like.

Who knows, it might even work in VR…

2 Likes

Collect a small list of camera floats Y and Z, And check its contents for the desired wav length pattern to emerge. Or for the contents to contain both max and min of the desired wave length.

this would b a very interesting mechanic indeed.

1 Like