2
2

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.

衝突判定のまとめと注意事項

Posted at

入力する箇所

図2.png

衝突するオブジェクトがすり抜けない場合

void OnCollisionEnter (Collision col)
    {
        if(col.gameObject.name == "getabako"){}
    }

{}の中には実行する内容を入力する

衝突するオブジェクトがすり抜けない場合の注意事項
①Colliderをつける
②どちらかにRigidBodyをつける

タグのつけかた

図3.png

衝突するオブジェクトがすり抜ける場合

void OnTriggerEnter (Collider col)
    {
        if(col.gameObject.tag == "getabako"){}
    }

{}の中には実行する内容を入力する

衝突するオブジェクトがすり抜ける場合の注意事項
①Colliderをつけて「isTrigger」にチェックをつける
②どちらかにRigidBodyをつける
②衝突するオブジェクトにタグをつける

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?