Created
November 23, 2013 23:35
-
-
Save ecto/7621390 to your computer and use it in GitHub Desktop.
Revisions
-
ecto created this gist
Nov 23, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ var G = 100; var vertex; for (var i = 0; i < plane.geometry.vertices.length; i++) { vertex = plane.geometry.vertices[i]; var distance = Math.sqrt(Math.pow(vertex.x - sphere.position.x, 2) + Math.pow(vertex.y - -sphere.position.z, 2)); var f = -(G * sphere.mass) / Math.pow(distance, 2); vertex.z = f; }