衝突した場所にballオブジェクト(プレハブ)を出現させたいと思い以下のスクリプトをかきましたが、座標をコンソールに出すことしかできませんでした・・・
Instantiate(ball, new Vector3(1, 1, 1), Quaternion.identity); の座標の部分を変え、forの中に加えるのでしょうか?
回答よろしくお願いします。
C#
1using UnityEngine; 2using System.Collections; 3 4public class ball : MonoBehaviour{ 5 public GameObject ball; 6void OnCollisionEnter(Collision collision){ 7 for (int aIndex = 0; aIndex < collision.contacts.Length; ++aIndex){ 8 Debug.Log(collision.contacts[aIndex].point); 9 } 10 } 11} 12
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/13 23:49
2016/05/14 08:02
2016/05/14 08:25
2016/05/14 08:29 編集