Apr 11

Unity3D?Script Manual???????

admin , 11:24 , unity 3d , 评论(1) , 引用(0) , 阅读(31073) , Via 本站原创 | |

Overview: Common Operations ???????

    ??????????????????Transform?/?Rigidbody?????????????????Transform?Rigidbody???????????????????????Y????5?????????

function Update(){

     transfom.Rotate(0,5,0);

}

?????????????????????

function Update(){

     transfom.Translate(0,0,2);

}


Overview: Keeping Track of Time ???????

    Time????????????????deltaTime?????????????Update?FixedUpdate?????????????Update?????FixedUpdate?????

    ???????????????????????????????????????????????

function Update() {
      transform.Rotate( 0, 5 * Time.deltaTime, 0);
}

?????

function Update() {
      transform.Translate(0, 0, 2 * Time.deltaTime);
}


????????????????????Time.deltaTime???????Time.deltaTime????????????????10?/?????????????10?/???????????????????????????????????????10?/??

???????????????????????????????????2??/?????????

function Update(){

      light.range+=2.0*Time.deltaTime;

}

???????????????????Time.deltaTime????????????????


Overview: Accessing Other Components ?????????

    ?????????????Renderer??????????????????Camera?????????????????????????????????

?????????????????

   ??                  ?????

Transform                transform

Rigidbody                rigidbody

Renderer                 renderer

Camera                   camera(only on camera objects)

Light                    light(only on light objects)

Animation                animation

Collider                 collider

…???

    ????????????????????Component,Behaviour?MonoBehaciour????????????????????????????????null?

    ??????????????????????GetComponent???

transform.Translate(0, 1, 0);
// ???
GetComponent(Transform).Translate(0, 1, 0);

    ??transform?Transform????????????????????????????(??)??????????????????????

??????????????GetComponent?????????????????????????????????????????????DoSomething?????OtherScript????OtherScript??????????????????????

// ?????????OtherScript??
    // ????DoSomething
function Update () {
otherScript = GetComponent(OtherScript);
otherScript.DoSomething();
}

Tags:
euwx93nohu3 Email Homepage
2012/06/09 13:25
???????????????
分页: 1/1 第一页 1 最后页
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]