Difference between revisions of "Setup Particle Collisions with the Unity Plugin V3"
Jump to navigation
Jump to search
(Created page with "{| |link=Unity|50px<br/><div style="text-align:center;"><<<</div> | __TOC__ |} Category:Unity_V3 Category:HowTo_V3") |
|||
Line 4: | Line 4: | ||
|} | |} | ||
+ | |||
+ | Particles can interact with environment in Unity.<br> | ||
+ | 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<br> | ||
+ | # Expand "Game Objects To Search"<br> | ||
+ | # Drag'n'drop game objects with mesh renderers in their hierarchy to be used as scene meshes.<br> | ||
+ | # Enter a pathname (relative to pack's root) to save the built scene mesh to. | ||
+ | # Click "Build Mesh". | ||
+ | # On your camera's [[PKFxRenderingPlugin component V3 | 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_V3#Enable_raycast_for_collisions | PKFxSettings]] | ||
[[Category:Unity_V3]] | [[Category:Unity_V3]] | ||
[[Category:HowTo_V3]] | [[Category:HowTo_V3]] |
Revision as of 14:37, 5 July 2018
![]() |
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