Skip to content

Instantly share code, notes, and snippets.

@sugi-cho
Created September 13, 2013 05:43
Show Gist options
  • Save sugi-cho/6547095 to your computer and use it in GitHub Desktop.
Save sugi-cho/6547095 to your computer and use it in GitHub Desktop.
てきとう。エラー出るはず!
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