Nez.Portable/ECS/Components/Renderables/SpringGrid.cs
/// <summary>
/// applies a force in a 3-dimensional direction
/// </summary>
/// <param name="force">Force.</param>
/// <param name="position">Position.</param>
/// <param name="radius">Radius.</param>
applies a force in a 3-dimensional direction
applies a force in a 3 - dimensional direction
public void applyDirectedForce(Vector3 force, Vector3 position, float radius)
        {
            position -= new Vector3(entity.transform.position + localOffset, 0);
            foreach (var mass in _points)
            {
                if (Vector3.DistanceSquared(position, mass.position) < radius * radius)
                    mass.applyForce(10 * force / (10 + Vector3.Distance(position, mass.position)));
            }
        }
public void applyDirectedForce ( Vector3 force , Vector3 position , float radius ) { position -= new Vector3 ( entity . transform . position + localOffset , 0 ) ; foreach ( var mass in _points ) { if ( Vector3 . DistanceSquared ( position , mass . position ) < radius * radius ) mass . applyForce ( 10 * force / ( 10 + Vector3 . Distance ( position , mass . position ) ) ) ; } }
applies a force in a 3-dimensional direction
applies a force in a 3 - dimensional direction
// translate position into our coordinate space
force
Vector3
None
position
Vector3
None
radius
float
None