随笔分类 -  Unityd

摘要:创建一个材质球 在摄像机上找到创建的材质球并添加 在UI中创建一个Rawimage的UI在上面添加材质球 就可以了 阅读全文
posted @ 2021-03-01 15:58 手札记 阅读(521) 评论(0) 推荐(0)
摘要:代码内容 public class Mouse : MonoBehaviour{ // Start is called before the first frame update void Start() { } // Update is called once per frame void Upd 阅读全文
posted @ 2020-10-23 23:46 手札记 阅读(1078) 评论(0) 推荐(0)
摘要:脚本 物体 画面 通过获取射线的坐标进行移动的 void Update() { AGF(); } public void AGF() { if (Input.GetMouseButton(1)) { //1获得鼠标点击屏幕的二维坐标 Vector3 mouse = Input.mousePositi 阅读全文
posted @ 2020-10-21 15:52 手札记 阅读(523) 评论(0) 推荐(0)
摘要:在button按钮上添加事件 这两个函数一样 说明添加上了 这个就是获取点击按钮的gameobject对象 这个就会获取自己本身的子物体上的组件 效果 对象-界面上内容-组件上的内容-最后输出内容-都一样 阅读全文
posted @ 2020-10-20 10:39 手札记 阅读(1748) 评论(0) 推荐(0)
摘要:public float Power = 10;//这个代表发射时的速度/力度等,可以通过此来模拟不同的力大小 public float Angle = 45;//发射的角度,这个就不用解释了吧 public float Gravity = -10;//这个代表重力加速度 private Vecto 阅读全文
posted @ 2020-09-18 00:34 手札记 阅读(1137) 评论(0) 推荐(0)
摘要:场景 发射点 代码 using System.Collections;using System.Collections.Generic;using UnityEngine; public class Trajectory : MonoBehaviour{ public GameObject targ 阅读全文
posted @ 2020-08-16 13:42 手札记 阅读(1366) 评论(0) 推荐(0)
摘要:using System.Collections;using System.Collections.Generic;using UnityEngine;/// <summary>/// 视角移动/// </summary>public class CameraCollider : MonoBehav 阅读全文
posted @ 2020-07-08 00:41 手札记 阅读(682) 评论(0) 推荐(0)
摘要:public float range = 1; //画一个线框,中心和半径。 private void OnDrawGizmosSelected() {//颜色 Gizmos.color = Color.red; //这个坐标的 半径大小 Gizmos.DrawWireSphere(transfor 阅读全文
posted @ 2020-07-02 22:07 手札记 阅读(335) 评论(0) 推荐(0)
摘要:private void OnCollisionEnter(Collision collision) { Destroy(collision.collider.gameObject); } 碰撞检测代码,物理碰撞代码 第二种检测 private void OnTriggerEnter(Collide 阅读全文
posted @ 2020-06-29 21:21 手札记 阅读(672) 评论(0) 推荐(0)
摘要:float size =Input.GetAxis("Mouse ScrollWheel"); 获取鼠标滚轴值 float h = Input.GetAxis("Horizontal"); //得到键盘左右控制 float v = Input.GetAxis("Vertical"); //得到键盘上 阅读全文
posted @ 2020-06-29 20:57 手札记 阅读(488) 评论(0) 推荐(0)
摘要:using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;[ExecuteInEditMode]public class ttttt : MonoBehaviour 阅读全文
posted @ 2020-06-29 14:11 手札记 阅读(1747) 评论(0) 推荐(0)
摘要:通过寻找本物体到达目标物体的最优路径考虑的通过搜索所以离自己最近的路径,通过最近路径到达终点路径过程中最近的路径,反复搜索最近到达终点 using System.Collections;using System.Collections.Generic;using UnityEngine;using 阅读全文
posted @ 2020-05-29 22:17 手札记 阅读(470) 评论(0) 推荐(0)
摘要:public Transform pos; public Transform pos1; public float value = 0; public float value1 = 0; //坐标和值 // Update is called once per frame void Update() 阅读全文
posted @ 2020-05-25 00:46 手札记 阅读(1422) 评论(0) 推荐(0)
摘要:第一 计算两点之间的距离或者向量的长度 float dis = (transform.position - player.position).sqrMagnitude 第二 绝对值 Mathf.Abs(); 第三 匀速移动 Vector3.MoveTowards(); 阅读全文
posted @ 2020-05-25 00:37 手札记 阅读(572) 评论(0) 推荐(0)
摘要:/// <summary> /// 获取鼠标点击坐标 /// </summary> Vector3 screenPosition;//将物体从世界坐标转换为屏幕坐标 Vector3 mousePositionOnScreen;//获取到点击屏幕的屏幕坐标 Vector3 mousePositionI 阅读全文
posted @ 2020-05-24 11:21 手札记 阅读(3567) 评论(0) 推荐(0)