【3Dゲームエンジン】Unity質問スレッド8at GAMEDEV
【3Dゲームエンジン】Unity質問スレッド8 - 暇つぶし2ch399:名前は開発中のものです。
14/03/31 22:24:28.92 qaf6tNiV.net
>>382
void Update () {
 if(Input.GetMouseButtonDown(0)) {
  Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  RaycastHit hit;
  if(Physics.Raycast(ray,out hit)) {
   if(hit.collider.gameObject == jimen) {
    var spawnPos = hit.point;
    spawnPos.y = jimen.transform.position.y + 10.0f;
    spawnPos.z = jimen.transform.position.z;
    Instantiate(ballPrefab,spawnPos,Quaternion.identity);
   }
  }
 }
}

jimenにCollider有りと仮定してます


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch