昨天我问了一个问题,该问题是关于如何始终使两个对象具有相同的y值。并且它起作用了,但是,我现在发布的是,我需要第二个多维数据集具有相同的y值BUT,且其第一个多维数据集的-Y值比第一个低-0.5个单位。我的原始多维数据集称为“播放器”,而脚本已附加到名为“ TestCube”的多维数据集。谢谢!
using UnityEngine;
using System.Collections;
public class testmovement : MonoBehaviour
{
Transform otherTransform;
void Start()
{
// you can set a reference to the "parent" cube
otherTransform = GameObject.Find("Player").transform;
}
void Update()
{
// here we force the position of the current object to have the same y as the parent
transform.position = new Vector3(transform.position.x, otherTransform.position.y, transform.position.z);
}
}
POPMUISE
ITMISS
呼唤远方
相关分类