繁体   English   中英

unity translation旋转导入的对象

[英]Unity translate rotate an imported object

我无法在导入的模型上统一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);
    }
}

在此处输入图片说明

根据您的图像,您不会正确执行此操作。 跟着这些步骤 :

  1. 将Gear模型从Assets拖放到场景中
  2. 在场景中选择Gear GameObject
  3. NewBehaviourScript从您的Assets拖放到Gear Gameobject的检查器中
  4. 在场景中拖动齿轮游戏物体给公众领域gear的的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);
    }
}

暂无
暂无

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

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