Exemplo n.º 1
0
        private void fluidEmulation1_ValueChanged(object sender, FluidEmulationArgs e)
        {
            try
            {
                _fluidEmulation = e;

                // Add/Remove fluid
                if (_fluidEmulation.EmulateFluid)
                {
                    if (_fluidHulls.Count == 0)         // if it's nonzero, then they already have a fluid hull assigned to them
                    {
                        foreach (Body[] bodySet in _bodySets)
                        {
                            foreach (Body body in bodySet)
                            {
                                ApplyFluidHull(body);
                            }
                        }
                    }
                }
                else
                {
                    _fluidHulls.Clear();
                }

                // Set viscosity
                _fluidField.Viscosity = _fluidEmulation.Viscosity;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
        private void fluidEmulation1_ValueChanged(object sender, FluidEmulationArgs e)
        {
            try
            {
                _fluidEmulation = e;

                // Add/Remove fluid
                if (_fluidEmulation.EmulateFluid)
                {
                    if (_fluidHulls.Count == 0)		// if it's nonzero, then they already have a fluid hull assigned to them
                    {
                        foreach (Body[] bodySet in _bodySets)
                        {
                            foreach (Body body in bodySet)
                            {
                                ApplyFluidHull(body);
                            }
                        }
                    }
                }
                else
                {
                    _fluidHulls.Clear();
                }

                // Set viscosity
                _fluidField.Viscosity = _fluidEmulation.Viscosity;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }