我如何在这里使用小数来改变位置
How Can I use Decimals here to change position
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour {
public Transform x;
public int moving = 1;
public GameObject Thing;
public Vector3 Offset;
void Start () {
}
void FixedUpdate()
{
x.transform.position = Thing.transform.position + Offset ;
if (Input.GetKey("w"))
{
Thing.transform.Translate(+1,0,0);
}
我不知道为什么但是在 "Thing.transform.Translate" 我不能使用十进制数。有什么办法解决这个问题吗?
The Cube Needs to move in Decimals
Unity 中的 float
数字后需要跟一个用 f
表示的转换。
Thing.transform.Translate(1.5f, 1.5f, 1.5f);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour {
public Transform x;
public int moving = 1;
public GameObject Thing;
public Vector3 Offset;
void Start () {
}
void FixedUpdate()
{
x.transform.position = Thing.transform.position + Offset ;
if (Input.GetKey("w"))
{
Thing.transform.Translate(+1,0,0);
}
我不知道为什么但是在 "Thing.transform.Translate" 我不能使用十进制数。有什么办法解决这个问题吗?
The Cube Needs to move in Decimals
Unity 中的 float
数字后需要跟一个用 f
表示的转换。
Thing.transform.Translate(1.5f, 1.5f, 1.5f);