Unity 求两 Vector3 的中间坐标

Unity 求两 Vector3 的中间坐标 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BetweenPoint : MonoBehaviour {

    public Transform pos1;
    public Transform pos2;
    public Transform betPre;
    // Use this for initialization
    Vector3 betweenPos;
	// Update is called once per frame
	void Update () {
        betweenPos = (pos1.position + pos2.position) / 2;
        betPre.position = betweenPos;
    }
}

测试结果:

Unity 求两 Vector3 的中间坐标

上一篇:redis中list常用命令


下一篇:Unity新手村—开发小技巧记录(一)