How to determine if a GameObject is being shaken?
I am developing a VR game and want to determine if an object is being shaken. Think soda can shaking up and down.
What a good way to test for this that wouldn't be triggered by normal movement? Meaning the player can pick it up and walk with it, but only the act of vigorously shaking it would trigger a function.
I'm thinking of tracking a transform's movement and velocity over time and if both are over a certain threshold then its shaking?
Comment
Definitely go with keeping track of velocities and find some good thresholds through trial n error, then just set a bool shaken
.