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. [Forward]Ten Caching Mistakes that Break your App

    Caching large objects, duplicate objects, caching collections, live objects, thread unsafe caching a ...

  2. mock数据和代码生成

    git clone https://gitee.com/fleam/CodeGeneration.git

  3. c算法

    斐波那契 void main() { ]={, }, i; ;i<=;i++) //这里需要注意,for循环虽然<=9, 还有个i++ { a[i] = a[i-] + a[i-]; pr ...

  4. 评点SAP HR功能及人力资源管理软件

    评点SAP HR功能及人力资源管理软件   本文导航 第1页:my SAP 人力资源软件 第2页:my SAP HR协同功能 第3页:组织结构管理 第4页:mySAPTM HR的战略功能 第5页:集成 ...

  5. linux下locale中的各环境变量的含义

    本文来自:http://blog.sina.com.cn/s/blog_406127500101dk26.html Locale是软件在运行时的语言环境, 它包括语言(Language), 地域 (T ...

  6. C# 中委托和代理是一个概念吗??

    刚刚看了一下资料,发现有些资料说的是代理,有的说是委托,但都是指同一样东西delegate,委托和事件是有关的,因为事件的本质就是多播委托,关于多播委托楼主可以找找资料就知道了. 不过个人觉得这两个概 ...

  7. unity---各种资源对应的格式

    我们打包AssetBundle后,Unity3D会根据文件的后缀名将文件转换为特定的类型对象存储起来,我们后期获取时需要根据这些类型取出打包的数据,这里记录下不同后缀文件打包后的类型. 文本格式 支持 ...

  8. 转载:erlang实现安卓和IOS的推送。

    erlang-百度云推送Android服务端功能实现-erlang erlang -- ios apns provider -- erlang 实现 转自:http://www.cnblogs.com ...

  9. iOS :UIPickerView reloadAllComponets not work

    编辑信息页面用了很多选择栏,大部分都用 UIPickerView 来实现.在切换数据显示的时候, UIPickerView 不更新数据,不得其解.Google 无解,原因在于无法描述自己的问题,想想应 ...

  10. bind带autocomplete时,最好是从新的tr复制

    (function($) { //自动关联ItemNo $.fn.extend({ productitemlist: function(options) { return this.each(func ...