Created
September 13, 2013 05:43
-
-
Save sugi-cho/6547095 to your computer and use it in GitHub Desktop.
てきとう。エラー出るはず!
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 characters
Mesh mesh = GetComponent<MeshFilter>().mesh; | |
Vector3 targetPoint; | |
Vector3[] vertices = mesh.vertices; | |
float power; //吸い込まれ力 | |
for(int i = 0; i < vertices.Length; i++){ | |
//ここら変の計算を変えて、吸い込まれ方を調整 | |
float d = (vertices[i] - targetPoint).sqrMagnitude; | |
vertices[i] += (vertices[i] - targetPoint)*Time.deltaTime*d*power; | |
} | |
mesh.vertices = vertices; | |
mesh.RecalculateNormals(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment