When the main fish gets eaten by the shark, the camera can move straight through the shark’s mesh. To register collisions with the “GvrMain” game object, add a box collider as a new component:
Now the shark can sense if it’s hit the main camera rig and can move out of the way. We’ll simply teleport the shark to the other side of the camera from which it collided.
Add in a private GameObject variable that will track the “GvrMain” object in the scene.
Add in a OnCollisionEnter function that will increase the shark’s speed, so that it can outrun the main camera. This will prevent frequent collisions with the camera after the game ends and the player is still propelled throughout the space.
Finally, make sure that none of the Shark’s coordinate positions are frozen in it’s RigidBody: