js操作unity模型旋转
2015-05-15 00:00
441 查看
#pragma strict
function Start () {
}
var run =0;
var isOn:boolean;
var RotateSpeed = 1000;
function Update () {
if (Input.touchCount == 1)
{
if(isOn == true){
isOn=false;
} else{
isOn=true;
}
//One finger touch does orbit
//
// touch = Input.GetTouch(0);
//
// x += touch.deltaPosition.x * xSpeed * 0.02;
//
// y -= touch.deltaPosition.y * ySpeed * 0.02;
}
if(isOn == true){
transform.Rotate(Vector3.up * Time.deltaTime * (-RotateSpeed));
}
}
function OnGUI()
{
//开关按钮,使用了三目运算符来控制显示on或者off
if(GUI.Button(Rect(0,0,200,40),(isOn)?"on":"off"))
{
//用三目运算符控制布尔类型开关变量值
if(isOn==true){
isOn=false;
}else{
isOn=true;
}
}
if(isOn)
{
//其他按钮的代码
}
}
function Start () {
}
var run =0;
var isOn:boolean;
var RotateSpeed = 1000;
function Update () {
if (Input.touchCount == 1)
{
if(isOn == true){
isOn=false;
} else{
isOn=true;
}
//One finger touch does orbit
//
// touch = Input.GetTouch(0);
//
// x += touch.deltaPosition.x * xSpeed * 0.02;
//
// y -= touch.deltaPosition.y * ySpeed * 0.02;
}
if(isOn == true){
transform.Rotate(Vector3.up * Time.deltaTime * (-RotateSpeed));
}
}
function OnGUI()
{
//开关按钮,使用了三目运算符来控制显示on或者off
if(GUI.Button(Rect(0,0,200,40),(isOn)?"on":"off"))
{
//用三目运算符控制布尔类型开关变量值
if(isOn==true){
isOn=false;
}else{
isOn=true;
}
}
if(isOn)
{
//其他按钮的代码
}
}
相关文章推荐
- js操作unity模型旋转
- Unity:Transform之四元数的移动端单指滑动旋转模型操作
- Unity:Transform之四元数的移动端单指滑动旋转模型操作
- unity js操作模型 加音频 需修改
- Unity:Transform之四元数的移动端单指滑动旋转模型操作
- 在Unity中通过触摸屏幕实现模型的旋转和缩放
- Unity 模型在移动端进行移动、旋转和放大(缩小)
- Unity通过射线碰撞选择模型,然后控制模型的移动、旋转、缩放等动作
- matlab旋转矩阵来旋转三维模型+meshlab旋转模型+matlab基础常用操作
- C#程序员整理的Unity 3D笔记(十):Unity3D的位移、旋转的3D数学模型
- unity3d鼠标滑动UIImage从而实现3D模型在UIImage上的左右旋转(RawImage映射)
- unity移动端操作方式(旋转、缩放手势)总结
- C#程序员整理的Unity 3D笔记(十):Unity3D的位移、旋转的3D数学模型
- C#程序员整理的Unity 3D笔记(十):Unity3D的位移、旋转的3D数学模型
- JS文档对象模型操作总结
- Unity入门操作_旋转_006
- unity3d 2d游戏鼠标拉近旋转拖拽模型操作
- Unity移动端手势操作——旋转3D物体
- UNITY移动平台上的手势操作——旋转、缩放
- stl格式模型导入osg后旋转操作