using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class myMove : MonoBehaviour
{
[SerializeField ]
private RectTransform imgmap; //小地图中可视的目标(小红点/小绿点)
void Start()
{
}
void Update()
{
OnMove();
float pointx = (157.3f / 49.79f) * transform.position.x;//图片长除以地图长
float pointz = (156.45f / 45.15f) * transform.position.z;//图片宽除以地图宽
imgmap.anchoredPosition = new Vector2(pointx, pointz);
}
private void OnMove()//移动方法
{
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
transform.Translate(Vector3.forward * v * 0.5f);
transform.Rotate (Vector3.up * h * 5f);
}
}
小地图另一种制作方法(需计算)
最新推荐文章于 2022-12-24 19:27:29 发布
由于博客内容为空,暂无法提供包含关键信息的摘要。
17万+





