1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Unity]衝突判定

Posted at

結果

OnCollision_Result.gif

前提

関数がわかること

手順

1. ステージ準備

  1. SphereとCubeを作成
  2. Cubeのscaleのxを5,zを5にする.
  3. 高さを結果のように調節
  4. SphereにRigidbodyをアタッチ

2. 衝突判定をする.

  1. 以下のスクリプトを記述
  2. スクリプトをSphereにアタッチ
using UnityEngine;
using System.Collections;

public class BallScript : MonoBehaviour {

	// 追加する部分
	void OnCollisionEnter(Collision col){
		Debug.Log ("Hit!");
	}
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?