- 博客(9)
- 收藏
- 关注
原创 Unity 截屏时,安卓和编辑器下,Rect的坑
#if UNITY_EDITOR //编辑器下,rect起点(0,0)在左上角!!! //好坑 Rect rect = new Rect(screenPos.x - width / 2, Screen.height - (screenPos.y + height / 2), width, height );#else //手机端下,rect起点(0,0)在左上角!!! Rect rect
2021-11-18 16:41:59
4192
原创 shader
1.remap函数 //当uv.x = 0时,结果等于 s1 = -1 //当uv.x = 1.0时,结果等于 s2 = 1 half remapX = remap(i.uv.x, 0, 1.0, -1.0, 1.0); //当uv.y = 0时,结果等于 s1 = -1 //当uv.y = 1.0时,结果等于 s2 = 1 half remapY = remap(i.uv.y, 0, 1.0, -1.0, 1.0);...
2021-04-28 10:02:34
101
原创 unity 记录获取ugui间的距离遇到的坑
目标:获取两个ugui元素的相隔距离坑: 当Match不为0时,Canvas的scale不会为1,在获取ui元素的宽度时,(endStep.rect.width / 2) * canvas.transform.localScale.x另:获取ugui的屏幕坐标 public static Vector2 GetScreenPos(Canvas canavas, RectTransform rect) { switch (canavas.renderMode)
2021-04-25 17:17:48
810
原创 Lua看书笔记
1.算术运算的Metamethods两个table进行算术运算(+,-,*,/),需要具有相同的metatable。通过setmetatable给表设置metatable,在对想应的_add,__mul ,__sub(减),__div(除),__unm(负),__pow(幂)等域进行定义。
2021-01-26 22:18:14
73
原创 最近复习的一些算法题
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApp1{class Program{static void Main(string[] args){//Console.WriteLine(ConsleA(7));//Console.ReadKey();//Start4();
2020-12-30 13:58:27
158
原创 unity Animator获得当前动画最真实的时间
public void InitData(Animator ani){ if (ani == null) { return; } m_animator = ani; m_animator.enabled = false; AnimationClip clip = m_animator.runtimeAnimatorController.animationClips[0]; speed = m_animator.GetCurrentAn
2020-07-14 16:13:27
2232
原创 unity 常见数学问题积累
1.求一个向量是另一个向量的顺时针还是逆时针使用Vector.dot()点积的值来判断。注意传入时的值必须统一,例如判断一个向量的左右向量的方向,每次都需要传入原向量作为rhs;2. 换算成数学题为:已知圆o上一点a,求旋转度数θ后,得到新的点P,求该点的位置,假设R为1解题过程为:设原来的点对应的为α,则x=1cosα,y=1sinα.所求新坐标为(m,n),对应的角为α-θ,则m=...
2020-04-01 16:00:58
189
原创 Unity 平抛运动,已知终点和起点
已知起点和终点,可知垂直距离h和水平距离x通过 h = 0.5gt*t计算 总时间 T = Mathf.Sqrt(2h/g)水平初速度 V水 = x/Tusing System.Collections;using System.Collections.Generic;using UnityEngine;public class ArrowCtrl : MonoBehaviour{...
2020-03-16 16:03:53
845
原创 unity ShaerSDK集成遇到的问题记录
1.环境配置,修改AndroidManifest的package,修改ShaerSDK中在官网申请到的AppKey和AppSecret,并对相应的App修改在开发者平台申请得到的AppKey和AppSecret2.打包安卓时必需要填入签名文件.stoer文件。3.打包出错时可将BuildSystem中的gradle改为Internal离线4.微信授权登陆第二次授权时直接登陆成功,不会在弹授权...
2020-03-11 11:27:29
136
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人