Setup Particle Collisions with the Unity Plugin V3
Particles can interact with environment in Unity.
You can choose to interact only with static environment and build a "scene mesh" or use raycast for collisions but it will impact performances.
Editor Scene Mesh
To build a scene mesh in Unity's Editor :
- Add a PKFxSceneMeshBuilder component to an object in your scene
- Expand "Game Objects To Search"
- Drag'n'drop game objects with mesh renderers in their hierarchy to be used as scene meshes.
- Enter a pathname (relative to pack's root) to save the built scene mesh to.
- Click "Build Mesh".
- On your camera's PKFxRenderingPlugin component make sure you enable the scene mesh collision and enter the same pathname.
Runtime Scene Mesh
You can also build a scene mesh during runtime. It will create a PKFxRuntimeMeshAsset.
- Call PKFxManager.SceneMeshAddMesh() to add a mesh to the scene mesh.
- Call PKFxManager.SceneMeshBuild("Meshes/RuntimeScenemesh.pkmm") to build the mesh.
- Call PKFxManager.LoadPkmmAsSceneMesh("Meshes/RuntimeScenemesh.pkmm") to load the mesh.
Raycast for collisions
You can enable the raycast for collisions in the PKFxSettings.