当前位置:网站首页>在Unity中让物体围绕自身的x、y、z轴进行旋转(亲测有效)
在Unity中让物体围绕自身的x、y、z轴进行旋转(亲测有效)
2022-08-10 05:35:00 【三和尚】
在Unity中让游戏物体围绕自身的x、y、z轴进行旋转(亲测有效)
void Update()
{
//当按着键盘的空格键时,物体就开始围绕自身的x轴进行旋转
if (Input.GetKey(KeyCode.Space))
{
//如果是围绕自身的x轴进行旋转,就是transform.Rotate(new Vector3(1, 0, 0));
//如果是围绕自身的y轴进行旋转,就是transform.Rotate(new Vector3(0, 1, 0));
//如果是围绕自身的z轴进行旋转,就是transform.Rotate(new Vector3(0, 0, 1));
transform.Rotate(new Vector3(1, 0, 0));
}
}
注意:这个脚本绑定的是要进行旋转的游戏物体上!
边栏推荐
猜你喜欢

The way for programmers to make money from a sideline business and increase their monthly income by 20K

pytorch-07.处理多维特征的输入

LeetCode 162. Finding Peaks (Moderate)
![[List Exercise] Traverse the collection and sort by price from low to high,](/img/49/183ebabf99e31af0d095bfd05a0b1f.png)
[List Exercise] Traverse the collection and sort by price from low to high,

Collection set interface

Common class String overview

LeetCode 100.相同的树(简单)

Common class BigDecimal

generic notes()()()

STM32F407ZG PWM
随机推荐
51单片机AD590温度测量ADC0832运放2.73V减法电压变换
力扣——情侣牵手
以STM32F103C6TA为例通过配置CubeMX实现GPIO输出完成点灯实例
51单片机营养液自动配置搅拌系统TDS浓度采集自动加水加营养液
I don't like my code
(Flutter报错)Cannot run with sound null safety, because the following dependencies
51单片机ST188手持人体温度脉搏心率测量仪锂电池充电
树结构——二叉查找树原理与实现
2021-04-15 jacoco代码覆盖率统计和白盒测试
2022李宏毅机器学习hw1--COVID-19 Cases Prediction
STM32单片机手机APP蓝牙高亮RGB彩灯控制板任意颜色亮度调光
【图像识别】训练一个最最简单的AI使其识别Vtuber
LeetCode refers to the offer 21. Adjust the order of the array so that the odd numbers are in front of the even numbers (simple)
pytorch-08.加载数据集
Gradle学习 (一) 入门
51单片机RS485远程双机多机温度采集主从机多节点蜂鸣器报警
每日刷题(day03)——leetcode 899. 有序队列
以STM32F103C6T6为例通过配置CubeMX实现EXIT外部中断
符号表
新建STM32F407ZG Keil5项目