using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class C_3_6 : MonoBehaviour {
public GameObject cube;
public GameObject cylinder;
void OnGUI() {
if (GUILayout.Button ("向左移动物体")) {
cube.transform.Translate (new Vector3(-0.5f, 0f, 0f));
}
if (GUILayout.Button ("向右移动物体")) {
cube.transform.position = cube.transform.position + new Vector3 (0.5f, 0f, 0f);
}
if (GUILayout.Button ("放大物体")) {
cube.transform.localScale *= 1.2f;
}
if (GUILayout.Button ("缩小物体")) {
cube.transform.localScale *= 0.8f;
}
if (GUILayout.Button ("旋转物体")) {
cube.transform.Rotate (new Vector3(0, 10, 0));
}
if (GUILayout.Button ("围绕球体旋转物体")) {
cube.transform.RotateAround (cylinder.transform.position, Vector3.up, 10);
}
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
Unity设置物体移动、缩放和旋转
最新推荐文章于 2025-05-28 12:09:50 发布