C# 我如何在这里使用小数来改变位置
我不知道为什么,但在这里的“Thing.transform.Translate”我不能使用十进制数。有办法解决这个问题吗C# 我如何在这里使用小数来改变位置,c#,unity5,C#,Unity5,我不知道为什么,但在这里的“Thing.transform.Translate”我不能使用十进制数。有办法解决这个问题吗 AfloatUnity中的数字后面需要跟一个用f表示的cast using System.Collections; using System.Collections.Generic; using UnityEngine; public class Move : MonoBehaviour { public Transform x; public int m
A
float
Unity中的数字后面需要跟一个用f
表示的cast
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);
}
好的,但我只能对十进制数使用浮点,比如1.5f,如何添加1.55?您可以使用与Thing.transform.Translate(1.55f,1.55f,1.55f)相同的方法添加多个十进制数字代码>
Thing.transform.Translate(1.5f, 1.5f, 1.5f);