Mathf.Lerp(float a,float b,float t)插值函数,当a < b时往a中插入t,以此来实现颜色,声音等渐变效果。

GameObject.FindWithTag(string tag)通过标签得到实例化的对象,实现跨脚本操作对象

GameObject.GetComponent<>()获得对象的组件

控制物体旋转相关:

Quaternion: 四元数

void Rotating(float h, float v)
{
Vector3 targetDir = new Vector3(h, 0, v);
Quaternion targetRotation = Quaternion.LookRotation(targetDir, Vector3.up);
Rigidbody r = GetComponent<Rigidbody>();
Quaternion newRotation = Quaternion.Lerp(r.rotation, targetRotation, turnSmoothing * Time.deltaTime);
r.MoveRotation(newRotation);
}

h为水平输入,v为垂直输入,该代码实现角色根据水平方向的输入旋转的功能

最新文章

  1. mysql乱码解决
  2. Nodejs基础中间件Connect
  3. JavaScript DOM 编程艺术(第2版)读书笔记 (9)
  4. HBase Error: connection object not serializable
  5. QT软键盘
  6. SQL-Server索引漫谈
  7. java学习面向对象之this
  8. 解决android studio 创建新项目后假死
  9. dropdownlist绑定和选中
  10. 模拟JQUERY的延迟方法绑定
  11. android随记
  12. Windows Azure Virtual Machine (34) 保护Azure虚拟机
  13. mkdir 命令详解
  14. PAT1078 Hashing 坑爹
  15. 支付宝红包口令自动复制到剪贴板脚本js,安卓,IOS通用版
  16. 第2章 术语 - Identity Server 4 中文文档(v1.0.0)
  17. 用人类社会工程学对C语言中的一些基本概念的剖析与理解
  18. 「洛谷1903」「BZOJ2120」「国家集训队」数颜色【带修莫队,树套树】
  19. 牛客练习赛 26 C题 城市规划【贪心】
  20. 访问 Google

热门文章

  1. Fix for: Permission denied to access property &#39;toString&#39;
  2. 通过 Chrome 调试运行在 IOS-safari 上的页面
  3. 安装配置maven私服-nexus
  4. python multiprocessing 使用
  5. Django template 过滤器
  6. Odoo作为后端时如何返回数据给webapp、移动端app
  7. ES6新特性1:let和const
  8. Python自动化之高级语法单例模式
  9. HDU 1171 (01背包问题)
  10. CAN总线布线规范