unity 平移图片_Transform.Translate 平移

本文介绍了Unity中Transform.Translate函数的用法,通过示例代码详细解释了如何在局部坐标系和世界坐标系下平移物体,包括沿物体自身轴向和世界轴向的平移操作。
摘要由CSDN通过智能技术生成

Transform.Translate 平移

function Translate (translation : Space = Space.Self) : void

Description描述

Moves the transform in the direction and distance of translation.

移动transform在translation的方向和距离。

简单的说,向某方向移动物体多少距离。

If relativeTo is left out or set to Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the movement is applied relative to the world coordinate system.

如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World 移动被应用相对于世界坐标系统。

using UnityEngine;

using System.Collections;

public class example : MonoBehaviour {

void Update() {

transform.Translate(Vector3.forward * Time.deltaTime);

transform.Translate(Vector3.up * Time.deltaTime, Spa

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值