I’m trying to make red light green light in cospaces. So how do I code it where if there is camera movement when the traffic light is red it should restart the scene? (I need replies asap thank you!)
You need to place an invisible barrier beside the light, then use a collision coblock to detect if the camera has broke the red light.
I hope it helps.
To solve this, the main question we need to ask is: how can we tell that the camera is moving?
This may depend on the device - on a laptop we use keys to move, so we can use the on key pressed events. This may not work in VR/mobile though.
To do this in a cross-device way, we would need to instead check the change in camera position over a small amount of time, for example, store the camera position in a variable and check the camera position after 0.2 seconds and compare them.
Hope that helps! Let me know if you have any further questions about this.
Geoff @ TechLeap