This section describes how to add particle effects to your scene. Open the code for the previous section
1. Add header file #import ' NVWorldParticles.h '
2. Drag the particle's resource file into the userres.bundle directory(The resources in this section are available below the tutorial)
3. About making particle files, this is not a narrative, please see the tutorial
"nvisionxr engine Basic introduction http://www.arvrschool.com/read-7381" )
4. Click Particle file, view the material name, and thenuserres.materialto configure the material path, such as:
in theonCreatemethod to instantiate a particle in a session, such as:
Code:
Nvworldparticles *snow = (nvworldparticles *) [[Self Getworld] getobjectbyname:@ "Snow"]; if (!snow) {snow = (nvworldparticles *) [[self Getworld] createobject:particles objectname:@ "Snow"]; Set the particle script name [Snow settechnique:@ "Snow"]; Set particle coordinates in space [snow setposition:nvposition (0.0, 20.0, 0.0)]; }
in theOnstratmethod to attach particles to the scene, such as
Code:
Nvworldparticles *snow = (nvworldparticles *) [[Self Getworld] getobjectbyname:@ "Snow"]; if (snow) {[Snow attachto:self]; The particle system starts playing [snow start]; }
in theOnStopmethod to remove particles from the scene, such as
Code:
Nvworldparticles *snow = (nvworldparticles *) [[Self Getworld] getobjectbyname:@ "Snow"]; if (snow) {//Control particle system end [snow stop]; [Snow Dettach]; }
To run the project, you can see such effects as:
The particle effect is added successfully, and you can try to use the particle editor to do a cool particle effect loading into the scene.
Nvisionxr_ios Tutorial Eight--adding particles to the scene