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));
    }

}

 

转载于:https://www.cnblogs.com/fengdaren/p/8681656.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值