using UnityEngine;
using System.Collections; public class sineWork : MonoBehaviour { float verticalSpeed = 5.0f; //Vertical speed
float verticalDistance = 6.0f; //Vertical distance float horizontalSpeed = ; //Horizontal speed float offset = 0.0f; //Vertical offset
float originalPos = ; //Original y position Vector3 nextPos = new Vector3(); //Stores the next position
Vector3 startingPos; // Use this for initialization
void Start () { } // Update is called once per frame
void Update () { //Get current position
nextPos = this.transform.position; //Calculate new vertical position
offset = ( + Mathf.Sin(Time.time * verticalSpeed)) * verticalDistance / 2.0f;
nextPos.y = originalPos + offset; //Calculate new horizontal position
nextPos.x -= horizontalSpeed * Time.deltaTime; //Apply new position
this.transform.position = nextPos;
}
}

最新文章

  1. [转]java web简单权限管理设计
  2. 如何在maven中添加jar包
  3. TCP 状态机
  4. 在主方法中定义一个大小为50的一维整型数组,数组i名为x,数组中存放着{1,3,5,…,99}输出这个数组中的所有元素,每输出十个换一行
  5. windows休眠命令
  6. javascript实例学习之八——无缝切换效果
  7. javascript 小日历
  8. oracle 实例名和服务名以及数据库名区别
  9. No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'
  10. [LeetCode] 200. Number of Islands 解题思路
  11. 字符设备驱动4: ioremap
  12. em,strong,b,i的区别
  13. JS中使用正则表达式替换对象里的大小写
  14. [物理学与PDEs]第2章第2节 粘性流体力学方程组 2.6 一维粘性热传导流体动力学方程组
  15. Linux下的常见压缩解压缩命令
  16. GIF录制
  17. 【转载】 pytorch之添加BN
  18. vue教程1-08 交互 get、post、jsonp
  19. vue.js 过渡&动画
  20. JUC锁之 框架

热门文章

  1. Java 之 File
  2. Python之排序
  3. 切图psd to html页面制作技术学习与总结
  4. Java如何滚动几个小时和几个月?
  5. Maven Web应用
  6. 创建自己的PKI公/私密钥对和公钥证书
  7. php写文件操作
  8. 绚丽而实用的jQuery/CSS3应用及源码
  9. linux下nginx安裝
  10. Linux-centos6.8下关闭防火墙