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;
}
}

sine曲线向前运动的更多相关文章

  1. 自动驾驶运动规划-Reeds Shepp曲线

    自动驾驶运动规划-Reeds Shepp曲线 相比于Dubins Car只允许车辆向前运动,Reeds Shepp Car既允许车辆向前运动,也允许车辆向后运动. Reeds Shepp Car运动规 ...

  2. 再谈CSS动画 - 说点不知道的(一)贝塞尔曲线

    今天重新翻看<CSS 揭秘>"过渡与动画"一章,并把该章代码重新敲了一遍,代码托管在我的Github,在此总结一些心得. 动画的奥秘 在网页中添加动画的目的是让用户有更 ...

  3. 编程之美读书笔记1.1——让CPU占用率曲线听你的指挥

    http://blog.csdn.net/pipisorry/article/details/36189155 <strong><span style="font-size ...

  4. AVR446_Linear speed control of stepper motor步进电机曲线分析

    1.1.  单片机代码处理 // 定义定时器预分频,定时器实际时钟频率为:72MHz/(STEPMOTOR_TIMx_PRESCALER+1) #define STEPMOTOR_TIM_PRESCA ...

  5. Canvas 线性图形(三):曲线

    前言 画曲线要用到二次贝塞尔曲线或三次贝塞尔曲线.贝塞尔曲线是计算机图形学中相当重要的参数曲线,在一些比较成熟的位图软件中也有贝塞尔曲线工具,如 PhotoShop. 二次贝塞尔曲线 二次贝塞尔曲线在 ...

  6. Unity Standard Assets 简介之 Characters

    这篇介绍Characters资源包.包含三个文件夹:FirstPersonCharacter.RollerBall.ThirdPersonCharacter. FirstPersonCharacter ...

  7. AGV

    AGV AGV是(Automated Guided Vehicle)的缩写,意即“自动导引运输车”,是指装备有电磁或光学等自动导引装置,它能够沿规定的导引路径行驶,具有安全保护以及各种移载功能的运输车 ...

  8. Python-基本图形绘制及库引用

    turtle库的使用 概述:turtle(海龟)库是turtle绘图体系的python实现 turtle库的理解: -有一只海龟,其实在窗体正中心,在画布上游走 -走过的轨迹形成了绘制的图形 -海龟由 ...

  9. 航空概论(历年资料,引之百度文库,PS:未调格式,有点乱)

    航空航天尔雅 选择题1. 已经实现了<天方夜谭>中的飞毯设想.—— A——美国2. 地球到月球大约—— C 38 万公里3. 建立了航空史上第一条定期空中路线—— B——德国4. 对于孔明 ...

随机推荐

  1. svn解决不能clean的方法

    http://blog.csdn.net/victory08/article/details/42100325 svn执行clean up后出现提示:svn cleanup failed–previo ...

  2. Python之2维list转置、旋转及其简单应用

    给一个矩阵,顺时针旋转顺序输出其元素,例如: 对于矩阵: [ 1, 2, 3 ] [ 4, 5, 6 ] [ 7, 8, 9 ] 输出为: 1,2,3,6,9,8,7,4,5 def transpos ...

  3. MyBatis where标签语句

    当 where 中的条件使用的 if 标签较多时,这样的组合可能会导致错误.当 java 代码按如下方法调用时: @Test public void select_test_where() { Use ...

  4. e789. 限制用JSpinner实现数字选择的值

    // Create a number spinner that only handles values in the range [0,100] int min = 0; int max = 100; ...

  5. e799. 限制JSlider的数值在标记以内

    By default, the slider can take on any value from the minimum to the maximum. It is possible to conf ...

  6. CI框架 -- 自动加载资源

    CodeIgniter 的"自动加载"特性可以允许系统每次运行时自动初始化类库.辅助函数和模型. 如果你需要在整个应用程序中全局使用某些资源,为方便起见可以考虑自动加载它们. 支持 ...

  7. Xianfeng轻量级Java中间件平台:菜单管理

    通过菜单管理,可以实现系统菜单的权限控制.用户个性化菜单功能等,当然很多系统支持在线开发,不用专门的开发工具编写代码,通过一些简单的设置就能开发出新的功能,有新功能增加到系统中,菜单管理功能也是必不可 ...

  8. Sublime Text 3技巧:支持GB2312和GBK编码

    From: http://blog.csdn.net/ubuntulover/article/details/21101979 Sublime Text 3与Sublime Text 2的不同 其实有 ...

  9. MATLAB出现:错误使用 xlsread (line 251)

    背景: matlab 2015b和Excel2003 方法: 改Excel的Com加载项 步骤: 1   2  3   4 

  10. [译]Angular-ui 之 多命名视图(Multiple Named Views)

    ◄上一篇 (Nested States & Nested Views)     下一篇 (URL Routing) ► 你可以给你的视图命名,以便可以在单个模版当中拥有一个以上的 ui-vie ...