using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.XR;

public class lession1 : MonoBehaviour
{
    private  GameObject obj;
    public GameObject target;
    private void Start()
    {
        //游戏对象(GameObject)位移,旋转,缩放,父子关系,坐标转换等相关操作都由它来处理
        //它是unity提供的极其重要的类

        //Vector3 主要用来表示三维坐标系中的一个点 或者是一个向量
        //Vector3 v = new Vector3 ();
        //v.x = 10;
        //v.y = 10;
        //v.z = 10;
        //只传xy,z默认值为0
        //Vector3 v2 = new Vector3(10,10);
        //一步到位 最常用的声明
        //Vector3 v3 = new Vector3(10,10,10);
        //随意赋值
        //Vector3 v4;
        //v4.x = 10;        
        //v4.y = 10;
        //v4.z = 10;
        //Vector3基本运算
        //+ - * / 
        // Vector3 v1 = new Vector3(1,1,1);
        //Vector3 v2 = new Vector3(2,2,2);
        //print(v1 + v2);
        //print(v1 * 10);
        //print(v1 / 10);
        //print(Vector3.zero);//000
        //print(Vector3.right);//100
        //print(Vector3.left);//-100
        //print(Vector3.forward);//把z轴作为物体的面朝向001
        //print(Vector3.back);//背朝向00-1
        //print(Vector3.up);//上朝向010
        //print(Vector3.down);//下朝向0-10
        //计算两个点之间的距离
        // print(Vector3.Distance(v1, v2));
        //得到物体位置的信息
        // print(this.transform.position);
        //通过position得到位置是相对世界坐标
        //相对父对象
        // print("父对象"+this.transform.localPosition);
        //如果你想以面板坐标为准来进行设置
        //那一定是通过localPosition来进行设置的
        //他们两个 可能出现是一样的情况
        //1.这个物体的父对象坐标 就是世界坐标系原点000
        //2.这个物体没有父对象
        //
        // this.transform.position = new Vector3(10,10,10);
        // this.transform.localPosition = Vector3.up * 10;
        //如果只想改变一个值
        //1.直接赋值
        //this.transform.position = new Vector3 (10,this.transform.position.y,this.transform.position.z);
        //2.先取出来 再赋值
        // Vector3 vppos = this.transform.localPosition;
        //vppos.x = 10;
        //this.transform.localPosition = vppos;
        //对象当前的各朝向
        //对象当前的面朝向
        //print(this.transform.forward);
        //对象当前的头顶朝向
        //print(this.transform.up);
        //对象当前的右手边
        //print(this.transform.right);

        //相对世界坐标系
        print(this.transform.lossyScale);//相对本地坐标系(父对象)
        print(this.transform.localScale);
        this.transform.localScale = new Vector3(3, 3, 3);
        this.transform.localScale +=  Vector3.one * Time.deltaTime;// (one 代表 111)

    }

    private void Awake()
    {
        GameObject obj = this.GameObject();
        //obj.SetActive(false);
        print("欧拉角"+transform.eulerAngles);//对应面板上的值
        //相对于父对象坐标角度
        print(transform.localEulerAngles);

    }
    private void Update()
    {   //时间停止
        //Time.timeScale = 0;
        //恢复正常
        //Time.timeScale = 1;
        //2倍速
        //Time.timeScale = 2;
        //受scale影响
        //print("间隔时间"+Time.deltaTime);
        //print("不受scale影响的"+Time.unscaledDeltaTime);
        //从开始到现在一共跑了多少帧(多少次循环)
        //print(Time.frameCount);

        //方式一 自己计算
        //路程 = 方向 * 速度 * 时间
        //this.transform.position = this.transform.position + this.transform. forward * 1 * Time.deltaTime;
        //this.transform.position += this.transform.forward * 1 * Time.deltaTime;
        //用当前的位置 + 我要动多长距离 得出最终所在得位置
        //方式二 API
        //参数一:表示位移多少 路程 = 方向 * 速度 * 时间
        //参数二:表示 相对标系 默认 该参数 是相对于自己坐标系得
        //1.相对于世界坐标系 得Z轴 动 始终是 相对于世界坐标系得z轴正方向移动
        //this.transform.Translate(Vector3.down * 1 * Time.deltaTime, Space.Self);

        //API计算
        //自转得
        //第一个参数 相当于 是旋转的角度 每一帧
        //第二个参数 默认不填 就是相对于自己坐标系 进行得旋转
        //this.transform.Rotate(new Vector3(0, 10, 0) * Time.deltaTime);
        //相对于世界坐标系
        //this.transform.Rotate(new Vector3(0, 10, 0) * Time.deltaTime, Space.World);
        //相对于某个轴 转多少度//参数一: 相对于哪个轴进行移动
        //参数二: 是转动得角度是多少
        //this.transform.Rotate(Vector3.up, 10 * Time.deltaTime);
        //相对于某一点转
        //参数一: 相对于那个点
        //参数二: 哪个轴
        //参数三:转的度数 旋转速度 * 时间
        //this.transform.RotateAround(Vector3.zero, Vector3.up, 10 * Time.deltaTime);
        //找到置顶物体以这个物体为轴旋转
        //GameObject target = GameObject.Find("Sphere");
        //this.transform.RotateAround(target.transform.position, Vector3.up, 10 * Time.deltaTime);
    }
    private void FixedUpdate() {
        //受Scale影响
        //print(Time.fixedDeltaTime);
        //不受Scale影响
        //print(Time.fixedUnscaledDeltaTime);
        //面板上可以改变物理帧时间//很少用到物理帧

    }
}