- 172 名前:名前は開発中のものです。 [2012/12/02(日) 12:19:41.09 ID:R87cK3aN]
- カメラの位置を変更できなくて困っています。
void Start () { // target is settinged in inspector this.transform.LookAt(target); } void Update () { // 1 = MouseRightButton if( Input.GetMouseButton(1)) { Vector3 tra = this.camera.ScreenToWorldPoint(Input.mousePosition); Vector3 v = Vector3.Normalize(tra - target.position) * 5.0f; this.transform.position = v; this.transform.LookAt(target); } } 以上のコードを書いてメインカメラにアタッチしてtargetには適当なオブジェクトの位置を入れています、 Input.mousePositionはちゃんとスクリーン座標が入ってきているみたいですが ScreenToWorldPointメソッドの戻り値が常に一定になってしまいます。 何がいけないのかわからないです。 わかる人教えてください。
|

|