How do I use a script to detect when the Camera is moving?

This small scene demonstrates the following:

1. A Create event that registers a node observer, which calls a function whenever the properties of a node changes (in this case the user's camera node, using vrGetBody()) and records the time that the change occurred
2. A Timestep event that looks at the time since the last camera movement, and toggles the enabled state of the button to be on when the camera is moving, and off when it is stationary.

Headset movement does not directly affect the user's Camera transform - there are additional child nodes specifically for that, so this solution should work to detect when tracked users are moving using the joypad controls, but not when they simply move their head.

Jamie is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.