//private ParticleRenderer _particleRenderer; void Start() { BallisticsSettings globalBallisticsSettings = GlobalSettings.Instance.ballisticsSettings; _terminalVelocity = globalBallisticsSettings.windVelocity + buoyancyVelocity; _position = transform.position; _localPosition = transform.localPosition; //var particleAnimator = GetComponent<ParticleAnimator>(); //particleAnimator.force = 0.5f * (1 / particleAnimator.damping - 1) * _terminalVelocity; //_particleRenderer = GetComponent<ParticleRenderer>(); }
// Start moving the projectile over the trajectory using UsedBallisticsSettings, // the current GameObject's position, the rotationTransform's orientation, and // the velocity vector. public void Start() { BallisticsSettings ballistics = UsedBallisticsSettings; _time = 0.0f; _isActive = true; _trajectory3D = new Trajectory3D(Projectile3D, transform.position, velocity); _headingFrequency = Mathf.Sqrt(_trajectory3D.k) * ballistics.rotationStiffness; _headingDamping = ballistics.rotationDamping; _windVelocity = ballistics.windVelocity; if (rotationTransform == null) { rotationTransform = transform; } AdvanceTime(0.0f); }
private static void WindowFunction(int windowID) { BallisticsSettings ballistics = GlobalSettings.Instance.ballisticsSettings; float yStep = 50, y = 10 - yStep; ballistics.gravity.y = -AddSlider("Gravity", "{0:0.0} m/s^2", -ballistics.gravity.y, 1, 20, y += yStep); ballistics.terminalVelocity = AddSlider("Terminal velocity", "{0:0} m/s", ballistics.terminalVelocity, 5, 100, y += yStep); ballistics.windVelocity.x = AddSlider("West wind", "{0:0} m/s", ballistics.windVelocity.x, -25, 25, y += yStep); ballistics.windVelocity.z = AddSlider("South wind", "{0:0} m/s", ballistics.windVelocity.z, -25, 25, y += yStep); ballistics.rotationStiffness = AddSlider("Rotation stiffness", "{0:0.0}", ballistics.rotationStiffness, 0, 10, y += yStep); ballistics.rotationDamping = AddSlider("Rotation damping", "{0:0.0}", ballistics.rotationDamping, 0, 2, y += yStep); }