首页 > 其他 > 详细

untiy中操作obj

时间:2018-03-31 12:32:15      阅读:205      评论:0      收藏:0      [点我收藏+]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class sh : MonoBehaviour {
    public GameObject cube1;
    public GameObject cube2;
    public GameObject cube3;

    // Use this for initialization
    void Start () {            
            Debug.Log ("hello world");        
        //第一种拖过来,第二种程序绑定
        cube1 = GameObject.Find("Cube1");  
        cube2 = GameObject.Find("Cube2");  
        cube3 = GameObject.Find("Cube3"); 

    }
    
    // Update is called once per frame
    void Update () {
        //旋转
        //this.transform.Rotate (Vector3.up*1,Space.Self);
        //this.transform.Translate (-Vector3.left * 0.2f, Space.World);
        /*this.transform.localScale = 
            new Vector3(1,
                        1 + Mathf.Sin(Time.time), 
                        1 + Mathf.Sin(Time.time));  */
        cube1.transform.Translate(Vector3.up*0.1f, Space.World);  
        cube2.transform.Rotate(Vector3.up*1,Space.Self);  
        cube3.transform.localScale = new Vector3(1 + Mathf.Sin(Time.time), 1 + Mathf.Sin(Time.time), 1 + Mathf.Sin(Time.time));
    }

}

 

untiy中操作obj

原文:https://www.cnblogs.com/fengdaren/p/8681656.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!