简介
1. 目的
按下手柄某一个键后,记录这一时刻的手柄的空间点并用图形可视化出来
2. 创建可视化Model
2.1 利用3Ds Max 软件,建一个四棱锥
2.2 注意3ds max 的单位,调整至合适
2.3 导出为FBX类型
3. 创建prefabs
3.1 将FBX模型拖入场景中,添加颜色,调整姿态,并拖入project中作为预设件prefabs
4. 今天空的GameObject,并创建添加AddPoint脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AddPoint : MonoBehaviour
{
public GameObject rectangularPyramid;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (OVRInput.Get(OVRInput.Button.Three))
{
Vector3 position = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch);
GameObject newPoint = GameObject.Instantiate(rectangularPyramid);
newPoint.transform.position = position;
}
}
}
手柄按键名称如下图