• 2024-10-31unity3d————三角函数
    先上代码,结合代码讲解:publicclassLesson2:MonoBehaviour{//StartiscalledbeforethefirstframeupdatevoidStart(){#region知识点一弧度、角度相互转化//弧度转角度floatrad=1;floatanger=rad*Math
  • 2024-07-11用Mesh绘制空心柱体,水管效果
    目录1.主要思路2.代码展示3.效果展示1.主要思路上下两面圆环,内外是展开的两个矩形面,通过Mesh依次绘制图形。2.代码展示usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;///<summary>///水管///</summary>[RequireComponent(
  • 2024-06-21Unity3D轮转图(有回正效果)
    注意:MainCamera需要挂载PhysicsRayCaster      Hierarchy中添加UI里面的EventSystem对象(用来相应拖拽事件)usingDG.Tweening;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.EventSystems;usingSystem.Linq;publicclassRotat
  • 2024-06-10第三人称游戏的相机控制
    第三人称游戏的相机控制Unity已经有了Cinemachine这一强大的插件来辅助开发者更容易地控制相机运动,但我觉得学习一下相机控制背后的原理还是挺有益的,没准哪天就你像定制某种相机控制的功能,又觉得Cinemachine难调呢!本文学习自JasperFlick大神的运动系列教程相机的旋转控制
  • 2024-05-15UnityShader数学基础篇
    MathfMathf和Math1、Math是C#中封装好的用于数学计算的工具类,位于System命名空间中。2、Mathf是Unity中封装好的用于数学计算的工具结构体,位于UnityEngine命名空间中。Mathf中的常用方法1.π-PIprint(Mathf.PI);2.取绝对值-Absprint(Mathf.Abs(-10.5f));//10.5p
  • 2024-03-15二维逆运动学 – 代码
    介绍在本系列的前一部分中,我们讨论了具有两个自由度的机械臂的反向运动学问题;如下图所示。在这种情况下,机械臂的长度和 通常是已知的。如果我们必须到达的点是 ,那么配置就变成了一个三角形,其中所有边都是已知的。然后,我们推导出了角度和的方程,它控制着机械臂关节的旋转:(1
  • 2024-01-31检查某个点是否靠近 Bounds 的指定边缘
    ///<summary>///检查某个点是否靠近Bounds的指定边缘///</summary>///<paramname="point"></param>///<paramname="bounds"></param>///<paramname="edgeDirection">edgeDire
  • 2023-09-26唐老狮Unity基础笔记
    唐老狮Unity基础笔记三角函数Mathf.Rad2DegMathf.Deg2Rad 坐标系 向量    
  • 2023-09-25Unity Mathf
     插值运算 
  • 2023-09-05unity圆内随机一个点
    ///<summary>///根据半径随机出园内的点///</summary>///<paramname="vRadius"></param>///<returns></returns>publicstaticVector2GetRandomInCircle(floatvRadius){
  • 2023-05-01跟随移动
    distance=Vector2.Distance(transform.position,player.transform.position);Vector2direction=player.transform.position-transform.position;direction.Normalize();floatangle=Mathf.Atan2(direction.y,direction.x)*Mathf.Rad2Deg;transform.position
  • 2023-04-22【Unity】旋转木马
    对三角函数进行实际操作,需要对木马移动进行平滑插值木马起伏采用的Cos函数的周期实现usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassMerryGoRound:MonoBehaviour{publicTransformnode;publicfloatrudis;
  • 2023-04-11携程代码轮转图
    usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.UI;usingUnityEngine.EventSystems;usingSystem;publicclassRotart2D:MonoBehaviour,IDragHandler,IEndDragHandler,IBeginDragHandler{publicImagep
  • 2023-04-11雷达图
    ///<summary>///雷达图///</summary>publicclassldt:MaskableGraphic{//将代码放在Image图片上publicfloat[]arr;protectedoverridevoidOnPopulateMesh(VertexHelpervh){vh.Clear();intn=arr.Length;if(n>=3)
  • 2023-03-10框选
     usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.AI;usingUnityEngine.UI;///<summary>//////</summary
  • 2023-02-25轮转图、雷达图、简单Dotween
    3d轮转图usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;//usingDG.Tweening;publicclassRotationChart:MonoBehaviour{
  • 2023-02-25C#2D轮转图
    usingSystem;usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.EventSystems;usingUnityEngine.UI;usingDG.Tw
  • 2023-02-24C#轮转图
     usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingDG.Tweening;publicclassRotationChart:MonoBehaviour{public
  • 2023-02-14unity 四元数旋转各元素值的计算方法
    //旋转轴Vector3axis=Vector3.up;//旋转弧度floatrad=50f*Mathf.Deg2Rad;Quaternionquaternion=newQuaternion();quaternion.x=Mathf.Sin(rad/2f)
  • 2023-02-14unity 保持物体大小不变
    ///<summary>///在透视投影时,改变相机的fov或物体的位置,让物体保持在屏幕上看起来的大小一样的缩放值///</summary>///<returns></returns>p
  • 2023-02-08UI画框选人加动态烘焙导航移动
     usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.AI;publicclassInputMag:MonoBehaviour{privateboolis
  • 2023-01-07记录一下绘制圆柱的过程
    usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.UI;publicclassCreatCylinder:MonoBehaviour{publicintn=
  • 2022-12-23RotationChart2D(轮转图2D)
    usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.UI;usingUnityEngine.EventSystems;usingDG.Tweening;publicclass
  • 2022-12-22雷达图(RadarMap)
    usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.Linq;usingUnityEngine;usingUnityEngine.UI;publicclassRadarMap:MaskableGraphic{