Ejemplo n.º 1
0
 public void AddShape(ObiEmitterShape shape)
 {
     if (!emitterShapes.Contains(shape))
     {
         emitterShapes.Add(shape);
         shape.particleSize = (emitterMaterial != null) ? emitterMaterial.GetParticleSize(solver.parameters.mode) : 0.1f;
         shape.GenerateDistribution();
         distEnumerator = GetDistributionEnumerator();
     }
 }
Ejemplo n.º 2
0
        /**
         * Sets particle solid radii to half of the fluids rest distance.
         */
        public void SetParticleRestRadius()
        {
            if (!InSolver)
            {
                return;
            }

            // recalculate rest distance and particle mass:
            float restDistance = (emitterMaterial != null) ? emitterMaterial.GetParticleSize(solver.parameters.mode) : 0.1f;

            for (int i = 0; i < particleIndices.Length; i++)
            {
                solidRadii[i] = restDistance * 0.5f;
            }

            PushDataToSolver(ParticleData.SOLID_RADII);
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.UpdateIfRequiredOrScript();

            Editor.DrawPropertiesExcluding(serializedObject, "m_Script");

            EditorGUILayout.HelpBox("Particle mass (kg):\n" +
                                    "2D:" + material.GetParticleMass(Oni.SolverParameters.Mode.Mode2D) + "\n" +
                                    "3D;" + material.GetParticleMass(Oni.SolverParameters.Mode.Mode3D) + "\n\n" +
                                    "Particle size:\n" +
                                    "2D:" + material.GetParticleSize(Oni.SolverParameters.Mode.Mode2D) + "\n" +
                                    "3D;" + material.GetParticleSize(Oni.SolverParameters.Mode.Mode3D), MessageType.Info);

            // Apply changes to the serializedProperty
            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();

                material.CommitChanges();
            }
        }