摘要: 1 // 已知方向,求物体的旋转 2 public static Quaternion GetRotation(Vector3 knownDirection) 3 { 4 knownDirection.Normalize(); 5 // Unity中的世界坐标系中,正前方通常为Vector3.for 阅读全文
posted @ 2024-09-12 17:17 zerozabuu 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using UnityEngine; 3 using System.Reflection; 4 public enum ExampleEnum 5 { 6 Value1, 7 Value2 8 } 9 class Program :MonoBehaviour 10 阅读全文
posted @ 2024-08-22 15:12 zerozabuu 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 * 3 * 1.2D顶牌跟随物体 4 * 2.顶牌始终位于物体包围盒中间下方边缘位置 5 * 3.自动计算顶牌中心点,避免顶牌遮挡物体 6 * 7 */ 8 using System.Collections.Generic; 9 using UnityEngine; 10 using 阅读全文
posted @ 2024-08-16 14:46 zerozabuu 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 代码说明: 点A:起始点。 方向B:一个方向向量,表示从点A出发的方向。 线段C:由两个点C1和C2定义。 1 using UnityEngine; 2 3 public class LineIntersection : MonoBehaviour 4 { 5 // 返回从点A出发,沿着方向B,与线 阅读全文
posted @ 2024-08-14 10:37 zerozabuu 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1 /// <summary> 2 /// 路径点排序 3 /// </summary> 4 /// <param name="start">路径起点</param> 5 /// <param name="input">路径上所有的点</param> 6 /// <param name="outpu 阅读全文
posted @ 2024-02-01 10:19 zerozabuu 阅读(14) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 获取JSON字符串中所有指定KEY的值 /// </summary> public static List<string> GetAllJsonValue(String jsonString, String key) { List<string> lst = ne 阅读全文
posted @ 2023-10-26 15:46 zerozabuu 阅读(625) 评论(0) 推荐(0) 编辑
摘要: 插件原方法: public Stream LoadStream(string relativeFilePath) { if (relativeFilePath == null) { throw new ArgumentNullException("relativeFilePath"); } stri 阅读全文
posted @ 2023-10-08 15:30 zerozabuu 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 项目中遇到使用 UnityGLTF插件加载GLTF模型时报错,如下图: 根据报错信息,我们找到GLTF文件中,第[五]个材质的描述: { "name": "11_-_Default木质长廊1.bmp_alpha", "occlusionTexture": { "index": 0, "texCoor 阅读全文
posted @ 2023-09-27 11:55 zerozabuu 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 工作中遇到使用UnityGLTF插件加载GLTF模型时,贴图显示错误的问题,如下图 检查材质时发现,把OcclusionTexture去掉就看起来正常了 看来是插件对OcclusionTexture的解析出了问题, 那么我们来看一下,GLTF中对OcclusionTexture的描述片段,是这样: 阅读全文
posted @ 2023-09-27 11:00 zerozabuu 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1.buffer.js ,three.js 这样引用会报错: import { Buffer } from 'buffer'; import * as THREE from 'three'; 所以需要找到node_modules里相关js文件,然后引用其文件路径(我是复制出来放到src文件夹下了), 阅读全文
posted @ 2023-09-19 11:16 zerozabuu 阅读(891) 评论(0) 推荐(0) 编辑