- 博客(6)
- 资源 (1)
- 收藏
- 关注

原创 unity开发下的C#学习笔记——第四章:鼠标匀速跟随
本程序实现了游戏对象跟随鼠标移动的功能,特点是:固定速度,实时调整方向面朝光标;using System.Collections;using System.Collections.Generic;using UnityEngine;public class Gensui : MonoBehaviour{ void Update() { Vector3 face = this.transform .up ; Vector3 .
2021-10-04 10:46:32
395
原创 unity开发下的C#学习笔记——第三章:向量
Vector3 a = new Vector3(2, 2, 0);//定义一个三维向量float length = a.magnitude;//计算a的长度Debug.Log("长度:" + length);Vector3 b = a.normalized;//把a变为单位向量Debug.Log("标准化为:" + b.ToString("F3"));//保留三位小数//x轴正方向向右//y轴正方向向上//z轴正方向向前//单位向量Vector3 c = Vector3.right .
2021-10-04 12:42:42
668
原创 unity开发下的C#学习笔记——第二章:父子节点
GameObject parent = this.transform.parent.gameObject;Debug.Log("父节点:" + parent.name);//获取父节点并打印输出//遍历子节点foreach (Transform child in transform ){ Debug.Log("子节点:" + child.name);}//一键注释选中部分,ctrl+k+cGameObject obj = GameObject.Find("dog");.
2021-10-04 12:23:48
668
原创 unity开发下的C#学习笔记——第一章:transform组件等
加了刚体就动不了了,后面会讲到public int Number = 10;//定义组件的属性,只有public属性才可以在inspector里显示private bool upward = true;//定义布尔值,private其他类不可调用Application.targetFrameRate = 60;//要求尽量以60帧运行transform.localEulerAngles = new Vector3(0, 0, 180);//绕Z轴逆时针旋转180度//人物左右平移的时候好像可以
2021-10-04 10:33:30
567
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人