This section teaches you how to switch back and forth in two scenarios.
Open the code for the previous section,
1, theMyfirstscenethe comment opens
2, theVideoscenethe boot state toGeneral_sceneplay,Code
Code:
Myfirstscene *firstscene = [[Myfirstscene alloc] initwithname:@ "First_scene"]; [[Nvappdirector Sharednvappdirector] addsceneplay:@ "Main_sceneplay" scene:firstscene]; Videoscene *videoscene = [[Videoscene alloc] initwithname:@ "Video_scene"]; [[Nvappdirector Sharednvappdirector] addsceneplay:@ "General_sceneplay" scene:videoscene];
3, soMyfirstsceneis set up as a startup scenario, andVideosceneset to wait for the scene.
OpenMYFIRSTSCENE.M, in tutorial Six has taught you how to do object interaction,
We switch scenes after clicking on the cube toVideoscene, if you have forgotten how to click the interaction, you can seeTutorial Six http://www.arvrschool.com/read-7392
Code:
// Click event - (void) OnClick: (nvwidget *) widget { // whether the clicked object is consistent with the object name of the cube if ([[widget getname] isequaltostring:@ "Cube"]) { // Jump from one scene to another. // need to pass in parameters for the scene corresponding to the name [self startsceneplayfrom:[self getname] to:@ "Video_scene"]; } }
this will jump to the video scene when you click on the cube. ; Similarly, we can set a clickable object in the video scene, and when clicked to the object, jump to Myfirstscene scene, so that the scene can be switched to each other.
This article mainly introduces two scenes of the switch, you can also try to more than one scene between the switch.
Nvisionxr_ios Tutorial 11-Multi-scene switching