} // DrawBoundingSphere #endregion #region Draw curve /// <summary> /// Draws a curve in world space. /// </summary> public static void Draw3DCurve(Curve3D curve, Color color, int step = 50) { if (!hasBegun || begin2D || primitiveType != PrimitiveType.LineList) { throw new InvalidOperationException("Line Manager: you have to call Begin in 3D mode and with PrimitiveType.LineList selected."); } AddVertex(curve.GetPoint(0), color); for (float i = curve.CurveTotalTime / step; i < curve.CurveTotalTime; i = i + (curve.CurveTotalTime / step)) { AddVertex(curve.GetPoint(i), color); AddVertex(curve.GetPoint(i), color); } AddVertex(curve.GetPoint(curve.CurveTotalTime), color); } // Draw3DCurve
} // Update /// <summary> /// Add particle. /// </summary> /// <param name="step">Step from last position to current position</param> protected override void AddParticle(float step) { // The position of the object. Vector3 objectPosition = Vector3.Lerp(previousPosition, Object.WorldPosition, step); // The matrix that will be used to transform the curve to the correct position. Matrix particleMatrix = Object.WorldRotation * Matrix.CreateTranslation(objectPosition); // Calculate the particle position using a random curve’s point and transforming it with the previous matrix. Vector3 particlePosition = Vector3.Transform(curve.GetPoint((float)random.NextDouble() * curve.CurveTotalTime), particleMatrix); // Add the particle. ParticleSystem.AddParticle(particlePosition, velocity); } // AddParticle