【3Dゲームエンジン】Unity質問スレッド7
■ このスレッドは過去ログ倉庫に格納されています
0377名前は開発中のものです。
2014/02/06(木) 21:20:20.34ID:qwQhorzKusing UnityEngine;
using System.Collections;
public class test2D : MonoBehaviour {
bool standFlg =true;
Vector2 standColSizeVec = new Vector2(1f, 1f);
Vector2 sitColSizeVec = new Vector2(1.5f,0.5f);
Vector2 standColCenterVec = new Vector2(0f,0f);
Vector2 sitColCenterVec=new Vector2(0f,-0.25f);
BoxCollider2D boxCl2d;
void Start () {
boxCl2d = gameObject.GetComponent<BoxCollider2D> ();
}
void Update () {
if (Input.GetKeyDown (KeyCode.X)) {
if (standFlg == true) {
boxCl2d.size = sitColSizeVec;
boxCl2d.center=sitColCenterVec;
standFlg = false;
} else {
boxCl2d.size = standColSizeVec;
boxCl2d.center=standColCenterVec;
standFlg = true;
}
}
}
}
多分こんな風。
でも3Dのやり方も同じようなものだったはずなので
それ見てわからんようならプログラム自体をちょっとやった方がいい。
■ このスレッドは過去ログ倉庫に格納されています