简体   繁体   English

unity translation旋转导入的对象

[英]Unity translate rotate an imported object

i can't translate.rotate (0,5,5) in unity on an imported model 我无法在导入的模型上统一translate.rotate (0,5,5)

what should i do to make it rotate i can't find a good source. 我应该怎么做才能使其旋转我找不到很好的来源。

my code is here: i put script under gear or main camera but it doesn't rotate i also selected model name on script 我的代码在这里:我将脚本放在齿轮或主摄像头下面,但它不会旋转,我也在脚本上选择了型号名称

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

在此处输入图片说明

According to your image, you don't do it corretly. 根据您的图像,您不会正确执行此操作。 Follow these steps : 跟着这些步骤 :

  1. Drag the Gear model from the Assets and drop it into your scene 将Gear模型从Assets拖放到场景中
  2. Select the Gear GameObject in your scene 在场景中选择Gear GameObject
  3. Drag the NewBehaviourScript from your Assets and drop it to the inspector of the Gear Gameobject NewBehaviourScript从您的Assets拖放到Gear Gameobject的检查器中
  4. Drag the Gear Gameobject in your scene to the public field gear of the NewBehaviourScript attached to the gear gameobject 在场景中拖动齿轮游戏物体给公众领域gear的的NewBehaviourScript连接到齿轮游戏对象

If you feel the 4th step is useless change the script as follow : 如果您认为第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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM