前提・実現したいこと
addForceを使ってダメージを表示したいのですがうまくいきません。
発生している問題・エラーメッセージ
http://satoukibi.hatenablog.com/entry/2017/02/25/Unity_でダメージUIを作る%282D%29
このページを参考に作ってみましたがうまく動作しませんでした。
表示はされるのですが、指定した座標に表示されるだけでaddForceが作用してないです。
該当のソースコード
C#
1int x = Random.Range(-80, 80); 2int y = Random.Range(100, 180); 3GetComponent<Rigidbody2D>().AddForce(new Vector2(x,y));
C#
1Transform mytransform = this.transform; 2Vector3 mypos = mytransform.position; 3string str = hit_dm.ToString(); 4Instantiate(DamageText, new Vector3(mypos.x,mypos.y,0), 5transform.rotation).GetComponent<TextMesh>().text = str;
試したこと
試しにURL先のスクリプトをまるまるコピーして試してみましたが、跳ねました。
スクリプトの全文の提示をお願いします。
あなたの回答
tips
プレビュー