Nez.Portable/ECS/Components/Renderables/SpringGrid.cs
/// <summary>
/// applies a force the pushes the grid out aware from the point
/// </summary>
/// <param name="force">Force.</param>
/// <param name="position">Position.</param>
/// <param name="radius">Radius.</param>
applies a force the pushes the grid out aware from the point
applies a force the pushes the grid out aware from the point
public void applyExplosiveForce(float force, Vector3 position, float radius)
        {
            position -= new Vector3(entity.transform.position + localOffset, 0);
            foreach (var mass in _points)
            {
                var dist2 = Vector3.DistanceSquared(position, mass.position);
                if (dist2 < radius * radius)
                {
                    mass.applyForce(100 * force * (mass.position - position) / (10000 + dist2));
                    mass.increaseDamping(0.6f);
                }
            }
        }
public void applyExplosiveForce ( float force , Vector3 position , float radius ) { position -= new Vector3 ( entity . transform . position + localOffset , 0 ) ; foreach ( var mass in _points ) { var dist2 = Vector3 . DistanceSquared ( position , mass . position ) ; if ( dist2 < radius * radius ) { mass . applyForce ( 100 * force * ( mass . position - position ) / ( 10000 + dist2 ) ) ; mass . increaseDamping ( 0.6f ) ; } } }
applies a force the pushes the grid out aware from the point
applies a force the pushes the grid out aware from the point
// translate position into our coordinate space
force
float
None
position
Vector3
None
radius
float
None