kingBook

导航

2024年7月21日 #

TypeScirpt 声明Map类型变量

摘要: let objs: Map<string, Object> = new Map<string, Object>(); objs.set("a", new Object()); 阅读全文

posted @ 2024-07-21 17:26 kingBook 阅读(1) 评论(0) 推荐(0) 编辑

TypeScript 声明函数类型变量

摘要: class Test { constructor() { } private _callback:Function; private _callback:(a:number, b:string)=>void; } 阅读全文

posted @ 2024-07-21 17:18 kingBook 阅读(1) 评论(0) 推荐(0) 编辑

2024年6月8日 #

Unity 创建一个规范的Package

摘要: 为包命名 xxx.xxx.xxx...@v.v.v (字母要小写,@后是包版本号) 包的布局 Packages ├── package.json ├── README.md ├── CHANGELOG.md ├── LICENSE.md ├── Third Party Notices.md ├── 阅读全文

posted @ 2024-06-08 08:17 kingBook 阅读(6) 评论(0) 推荐(0) 编辑

2024年6月4日 #

Git 保留空文件夹结构

摘要: 假设有如下 helloworld 项目结构: helloworld |--.git |--.gitignore |--Builds |--WebGL |--iOS |--Android 现在有个需求,在上传到 github 仓库时,只想保留 WebGL、iOS、Android 文件夹的结构,不想要里 阅读全文

posted @ 2024-06-04 19:17 kingBook 阅读(1) 评论(0) 推荐(0) 编辑

2024年6月3日 #

Python 执行cmd命令

摘要: run.py # coding=utf-8 import os # 使用 ' 或 " 或 ''' 表示字符串 cmd = "echo 123" os.system(cmd) 使用 os.system(cmd) 执行cmd命令 cmd 命令换行时加 &\ 阅读全文

posted @ 2024-06-03 17:56 kingBook 阅读(3) 评论(0) 推荐(0) 编辑

2024年5月23日 #

Cocos Creator 安卓环境配置

摘要: 系统:Win10,引擎版本:CocosCreator3.8.2, 时间:2024.05.23 安装 Java SDK(JDK)下载地址 注意:Java版本对应的Gradle: 详见表 Table 1. Java Compatibility 此处选择 Java 21 对应 Gradle 8.5 配置J 阅读全文

posted @ 2024-05-23 04:13 kingBook 阅读(36) 评论(0) 推荐(0) 编辑

2024年5月20日 #

VS2022 报错“当前页面的脚本发生错误 ”

摘要: 报错如下: 菜单:帮助->注册Visual Studio 单击"账户选项" 选择"系统Web浏览器" 阅读全文

posted @ 2024-05-20 23:49 kingBook 阅读(22) 评论(0) 推荐(0) 编辑

2024年1月17日 #

计算任意多边形的面积及判断顶点的顺或逆时顺序

摘要: 对于凸多边形,如下图,以多边形的某一点为顶点,将其划分成多个三角形,计算这些三角形的面积,然后加起来即可。已知三角形顶点坐标,三角形面积可以利用向量的叉乘来计算。 图1 对于凹多边形,如下图,如果以$A$为顶点,将其划分成多个三角形,则多边形的面积 $S= S_{ABC} + S_{ACD} + S 阅读全文

posted @ 2024-01-17 23:07 kingBook 阅读(30) 评论(0) 推荐(0) 编辑

2023年12月31日 #

法线纹理

摘要: 1.在切线空间下计算 struct Attributes { float4 positionOS : POSITION; float3 normal:NORMAL; float4 tangent : TANGENT; float4 texcoord : TEXCOORD0; }; 使用TANGENT 阅读全文

posted @ 2023-12-31 02:51 kingBook 阅读(8) 评论(0) 推荐(0) 编辑

2023年12月17日 #

单张纹理

摘要: _MainTex_ST 的名字不是任意起的,在Unity中,需要使用纹理名_ST的方式来声明某个纹理的属性,其中,ST 是缩放(scale)和平移(translation)的缩写。_MainTex_ST可以让我们得到该纹理的缩放和平移(偏移)值,_MainTex_ST.xy 存储的是缩放值,而 _M 阅读全文

posted @ 2023-12-17 04:24 kingBook 阅读(12) 评论(0) 推荐(0) 编辑

2023年12月16日 #

实现高光反射光照模型

摘要: Phong高光反射模型 \(C_{specular}=(C_{light} \cdot M_{specular})max(0,\hat{V} \cdot \hat{R})^{M_{gloss}}\) 其中,\(C_{light}\) 是光源的颜色,\(M_{specular}\) 是材质的高光反射颜 阅读全文

posted @ 2023-12-16 04:54 kingBook 阅读(11) 评论(0) 推荐(0) 编辑

2023年12月15日 #

实现漫反射光照模型

摘要: 漫反射光照符合兰伯特定律(Lambert's law),基本光照模型中漫反射计算公式: \(C_{diffuse}=(C_{light} \cdot M_{diffuse})max(0,\hat{N} \cdot I )\) 其中,\(C_{light}\) 是光源的颜色,\(M_{diffuse} 阅读全文

posted @ 2023-12-15 07:36 kingBook 阅读(23) 评论(0) 推荐(0) 编辑

2023年7月7日 #

基本初等函数的求导公式

摘要: ![image](https://img2023.cnblogs.com/blog/714380/202307/714380-20230707055144363-1485694860.jpg) 阅读全文

posted @ 2023-07-07 05:32 kingBook 阅读(16) 评论(0) 推荐(0) 编辑

2023年6月25日 #

快速求解矩阵特征值

摘要: 当求一个矩阵的特征值时一般将特征方程化为以下形成形式. $\left | \lambda E-A \right | =(\lambda-\lambda_{1})(\lambda-\lambda_{2})(\lambda-\lambda_{3})=0$ 例:$A=\begin{bmatrix} 1& 阅读全文

posted @ 2023-06-25 23:15 kingBook 阅读(446) 评论(0) 推荐(0) 编辑

2023年6月24日 #

制作瀑布

摘要: 使用的瀑布模型: ![image](https://img2023.cnblogs.com/blog/714380/202306/714380-20230624031504788-1568843861.png) 瀑布模型使用的材质 Demo_WaterFall.mat: ![image](https 阅读全文

posted @ 2023-06-24 03:49 kingBook 阅读(14) 评论(0) 推荐(0) 编辑

2023年6月3日 #

求炮弹在某一时刻的运动方向和速度大小

摘要: **例:** 以初速度$v_{0}$、发射角$a$发射炮弹,其弹道的轨迹方程为 $ \begin{cases} & x=v_{0}t\cos a ,\\ & y=v_{0}t\sin a-\frac{1}{2}gt^{2} , \end{cases} $ 求: 1. 炮弹在 $t$ 时刻的运动方向; 阅读全文

posted @ 2023-06-03 15:33 kingBook 阅读(63) 评论(0) 推荐(0) 编辑

2023年5月17日 #

Unity 2022 (Windows 10) 每次打开项目都会弹出"Unity is running as administrator"

摘要: 1.Win+R 输入 control,打开控制面板. 2.找到 用户账户 -> 更改用户账户控制设置. 3.将滑块调用中间 仅当应用尝试更改我的计算机时通知我(默认). 4.重启电脑 阅读全文

posted @ 2023-05-17 20:42 kingBook 阅读(1953) 评论(0) 推荐(0) 编辑

2023年3月26日 #

三次多项式的因式分解——双十字相乘法

摘要: https://zhuanlan.zhihu.com/p/455686319 阅读全文

posted @ 2023-03-26 21:58 kingBook 阅读(213) 评论(0) 推荐(0) 编辑

2023年3月1日 #

Unity URP 平面反射

摘要: https://www.bilibili.com/video/BV1TA4y1D7s4/?spm_id_from=333.999.0.0&vd_source=5672eeb8a9721da01495e313f0dff6c2 https://zhuanlan.zhihu.com/p/493766119 阅读全文

posted @ 2023-03-01 23:48 kingBook 阅读(133) 评论(0) 推荐(0) 编辑

2023年2月27日 #

Unity URP Shader 基础光照

摘要: 光照:https://zhuanlan.zhihu.com/p/232193169 光照:https://www.jianshu.com/p/5641bfe91458 高光:https://zhuanlan.zhihu.com/p/245906244 阴影:https://blog.csdn.net 阅读全文

posted @ 2023-02-27 17:04 kingBook 阅读(221) 评论(0) 推荐(0) 编辑

2023年2月17日 #

排列与组合、二项式定理

摘要: 排列的定义:从n个不同元素中,任取m (m≤n,m与n均为自然数) 个不同的元素按照一定的顺序排成一列,叫做从n个不同元素中取出m个元素的一个排列;从n个不同元素中取出m (m≤n) 个元素的所有排列的个数,叫做从n个不同元素中取出m个元素的排列数,用符号$A(n,m)$或$A^m_n$表示。 计算 阅读全文

posted @ 2023-02-17 20:15 kingBook 阅读(194) 评论(0) 推荐(0) 编辑

2023年2月15日 #

unity 单摆模拟

摘要: using System; using UnityEngine; using System.Collections; using UnityEngine.Serialization; public class Pendulum : MonoBehaviour { public Transform a 阅读全文

posted @ 2023-02-15 15:33 kingBook 阅读(119) 评论(0) 推荐(0) 编辑

2023年2月14日 #

unity 四元数旋转各元素值的计算方法

摘要: // 旋转轴 Vector3 axis = Vector3.up; // 旋转弧度 float rad = 50f * Mathf.Deg2Rad; Quaternion quaternion = new Quaternion(); quaternion.x = Mathf.Sin(rad / 2f 阅读全文

posted @ 2023-02-14 22:50 kingBook 阅读(38) 评论(0) 推荐(0) 编辑

2022年12月28日 #

URP 空间转换

摘要: $\begin{Bmatrix}模型空间(model\ space) \对象空间(object\ space) \局部空间(local\ space) \end{Bmatrix} \underbrace{\Rightarrow }{模型变换} \begin{Bmatrix}世界空间(world\ s 阅读全文

posted @ 2022-12-28 22:26 kingBook 阅读(415) 评论(0) 推荐(1) 编辑

2022年9月21日 #

Win10 OneNote 一直卡的登录界面

摘要: Internet选项 -> 高级,勾选使用 SSL 3.0 阅读全文

posted @ 2022-09-21 10:19 kingBook 阅读(82) 评论(0) 推荐(0) 编辑

2022年9月16日 #

mul()函数

摘要: https://blog.csdn.net/Ling_SevoL_Y/article/details/120206679 | 函数 | 说明 | | | | | mul(M,N) | 计算两个矩阵相乘,如果 M 为 AxB 阶矩阵,N 为 BxC 阶矩阵,则返回 AxC 阶矩阵。下面两个函数为其重载 阅读全文

posted @ 2022-09-16 14:39 kingBook 阅读(185) 评论(0) 推荐(0) 编辑

2022年9月5日 #

Unity 导入人形骨骼模型及动画

摘要: 例:当导入名称为 Women 的模型,这一般分为两个部分: 包含有蒙皮网格(SkinnedMeshRenderer)和骨骼的 Women.fbx 主要导入设置: Rig -> AnimationType : Humanoid Animation -> Import Animation: false 阅读全文

posted @ 2022-09-05 21:05 kingBook 阅读(203) 评论(0) 推荐(0) 编辑

2022年8月26日 #

UnityEditor Undo

摘要: 最重要的几项操作如下所述: 修改单个属性: Undo.RecordObject (myGameObject.transform, "Zero Transform Position"); myGameObject.transform.position = Vector3.zero; 添加组件: Und 阅读全文

posted @ 2022-08-26 14:00 kingBook 阅读(57) 评论(0) 推荐(0) 编辑

UnityEditor 查找和获取内置资源

摘要: Object[] UnityAssets = AssetDatabase.LoadAllAssetsAtPath("Resources/unity_builtin_extra"); foreach (var asset in UnityAssets) { Debug.Log(asset); } De 阅读全文

posted @ 2022-08-26 12:22 kingBook 阅读(124) 评论(0) 推荐(0) 编辑

2022年8月23日 #

UnityEditor 获取FileID/LocalIdentfierInFile

摘要: private static int GetLocalIdentfierInFile(UnityEngine.Object obj) { PropertyInfo info = typeof(SerializedObject).GetProperty("inspectorMode", Binding 阅读全文

posted @ 2022-08-23 17:46 kingBook 阅读(285) 评论(0) 推荐(0) 编辑

2022年8月17日 #

网格数据

摘要: 设有以下一维网格数据 // sbyte:8 位带符号整数,取值范围[-128,127] sbyte[] gridData=new sbyte[]{ 0,1,2, 3,4,5, 6,7,8 }; col: 列数(竖向有几列,一般用于表示 x) | | | | | | | | | | | | row:行 阅读全文

posted @ 2022-08-17 16:58 kingBook 阅读(95) 评论(0) 推荐(0) 编辑

2022年7月17日 #

Unity Editor 使文本输入框失去焦点

摘要: GUIUtility.keyboardControl = 0; 阅读全文

posted @ 2022-07-17 17:44 kingBook 阅读(154) 评论(0) 推荐(0) 编辑

Unity Editor 复制内容到剪切板

摘要: string str="acd12335"; TextEditor textEditor = new TextEditor(); textEditor.text = str; textEditor.SelectAll(); textEditor.Copy(); 阅读全文

posted @ 2022-07-17 16:50 kingBook 阅读(115) 评论(0) 推荐(0) 编辑

2022年6月28日 #

Unity 在编辑器中输入字符串时,转义字符的输入

摘要: 当使用如下代码,然后在 Unity 编辑器中输入 "Time Out\n Fail",当在代码中读取时并不能读取到换行符"\n",而是读取到加转义符后的"\\n" using UnityEngine; public class TestText : MonoBehaviour { [Serializ 阅读全文

posted @ 2022-06-28 17:09 kingBook 阅读(442) 评论(0) 推荐(0) 编辑

2022年6月23日 #

Unity VideoPlayer使用url方式,Android平台下无法播放http链接的视频(黑屏、无反应、无报错、无log输出)

摘要: 以下内容基于 Unity 2019.4.28f1c1,未来可能有变化 (以下 Other Settings 供参考,未必影响) Edit → Project Settings → Player → Android平台 → Other Settings :设置如下 Rendering Auto Gra 阅读全文

posted @ 2022-06-23 17:25 kingBook 阅读(715) 评论(0) 推荐(0) 编辑

2022年6月19日 #

UnityEditor 编辑器脚本执行菜单

摘要: 例:执行 Edit/Duplicate 菜单 [MenuItem("Tools/Duplicate")] private static void ExecuteDuplicate() { bool isExecute = EditorApplication.ExecuteMenuItem("Edit 阅读全文

posted @ 2022-06-19 18:09 kingBook 阅读(123) 评论(0) 推荐(0) 编辑

2022年6月10日 #

Unity 检测对象是否在相机的视锥体范围内

摘要: TestInCamera.cs using System.Collections; using System.Collections.Generic; using UnityEngine; using Stopwatch = System.Diagnostics.Stopwatch; [Requir 阅读全文

posted @ 2022-06-10 16:32 kingBook 阅读(140) 评论(0) 推荐(0) 编辑

2022年5月30日 #

Win 将资源管理器固定在任务栏后,右键时卡死

摘要: 删除注册表项:HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\Library Location FixContextMenu.reg Windows Registry Editor Version 5.00 [-HKEY_CLASSES_RO 阅读全文

posted @ 2022-05-30 20:03 kingBook 阅读(43) 评论(0) 推荐(0) 编辑

2022年5月24日 #

unity URP 灯光烘焙记录

摘要: Mesh 需要焙焙的模型网格,勾选 Contribute GI、BatchingStatic Light: Directional Light: 一般用于主灯光,模式为 Realtime Spot Light: 模式为 Mixed, 开启阴影 Point Light:模式为 Mixed, 开启阴影( 阅读全文

posted @ 2022-05-24 16:20 kingBook 阅读(661) 评论(0) 推荐(0) 编辑

2022年5月21日 #

3.3 三角函数的积化和差与和差化积

摘要: ![image](https://img2022.cnblogs.com/blog/714380/202205/714380-20220521123433722-1000145496.png) 阅读全文

posted @ 2022-05-21 12:35 kingBook 阅读(163) 评论(0) 推荐(0) 编辑