2017-06-15 33 views
-1

我可以对输入的模型统一翻译旋转一个导入的对象

我应该怎么做,使之旋转,我无法找到一个很好的来源不统一translate.rotate (0,5,5)

我的代码是在这里:我把脚本下的齿轮或主摄像头,但它不会转动我的脚本

using System.Collections; 
using System.Collections.Generic; 
using UnityEngine; 

public class NewBehaviourScript : MonoBehaviour { 
    public GameObject gear; 
    // Use this for initialization 


    // Update is called once per frame 
    void Update() { 
     gear.transform.Rotate (100, 10, 10); 
    } 
} 

enter image description here

+0

脚本既主摄像头和对象下.... – dsada

回答

2

还选择型号名称根据你的形象,你不”不正确地做到这一点。从Assets

  1. 拖动齿轮模型,并将其拖放到你的场景
  2. 在场景选择齿轮游戏对象
  3. 将您AssetsNewBehaviourScript拖放到的检验员:请按照下列步骤齿轮游戏对象
  4. 拖动齿轮游戏对象在场景中的公共领域安装在齿轮游戏对象
NewBehaviourScript

如果你觉得第4步是没用的变化脚本如下:

using System.Collections; 
using System.Collections.Generic; 
using UnityEngine; 

public class NewBehaviourScript : MonoBehaviour { 

    // Update is called once per frame 
    void Update() { 
     transform.Rotate (100, 10, 10); 
    } 
} 
+0

是的,我做的已经 – dsada

+0

没有,根据你的形象,你已将齿轮**模型**(资产)拖放到脚本文件(资产)中。不是你场景中的**实例**。 – Hellium

+0

我做了同样的工作,现在正在工作...... – dsada