UiShake
来源:互联网 发布:凯酷 mac 编辑:程序博客网 时间:2024/06/06 00:38
using UnityEngine;
{
[SerializeField]
protected Transform m_ShakeParent;
//Shake properties
[SerializeField]
protected Vector3 m_ShakeDirections;
[SerializeField]
protected float m_ShakeMagnitude, m_ShakeScale;
[SerializeField]
protected float m_BobFrequency, m_BobNoiseScale;
//Update calls shake helper function
protected virtual void Update()
{
DoShake();
}
//Shake helper function
private void DoShake()
{
//Calculates bob based on Perlin Noise
float xNoise = (Mathf.PerlinNoise((Time.realtimeSinceStartup + 0) * m_ShakeScale, Time.smoothDeltaTime) * 2 - 1) * m_ShakeMagnitude;
float zNoise = (Mathf.PerlinNoise((Time.realtimeSinceStartup + 100) * m_ShakeScale, Time.smoothDeltaTime) * 2 - 1) * m_ShakeMagnitude;
float yNoise = Mathf.Abs(Mathf.Sin(Time.realtimeSinceStartup * Mathf.PI * m_BobFrequency)) * m_ShakeMagnitude;
yNoise *= Mathf.PerlinNoise((Time.realtimeSinceStartup + 50) * m_BobNoiseScale, Time.smoothDeltaTime);
Vector3 offset = Vector3.Scale(m_ShakeDirections, new Vector3(xNoise, yNoise, zNoise));
m_ShakeParent.transform.localPosition = offset;
}
}
阅读全文
0 0
- UiShake
- http长连接,短连接,长轮询,短轮询
- 阿里云移动云Apsara Mobile重磅发布 推出Cloud Native App全新研发范式
- 我的第一个博客
- 解决手机1像素问题
- Ajax工作原理
- UiShake
- iis 6/7/7.5/8/8.5 版本中使用openssl自签名证书的步骤
- Cannot open channel to 3 at election address 机器名/IP:端口
- HEVC学习(七) —— 帧内预测系列之五
- springMVC中前端将传递数据传递到后端后端的接收方式
- 关于c语言中获取时间及格式和操作
- 数据库隔离级别
- 【源码】canal和otter的高可靠性分析
- 23 查看真实基数--优化主题系列