zoukankan      html  css  js  c++  java
  • untiy中操作obj

    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));
        }
    
    }
  • 相关阅读:
    2021 3 11 结队博客
    第一周 2021.03.07
    2021 3 5 知识点总结
    2021 3 3 每日总结
    2021 3 2 新学期的第一篇博客
    十天冲刺09
    二阶段之四
    安卓开发之实现手机验证码登录
    安卓布局(三)
    安卓布局(二)
  • 原文地址:https://www.cnblogs.com/fengdaren/p/8681656.html
Copyright © 2011-2022 走看看