
本文共 5086 字,大约阅读时间需要 16 分钟。
���������Unity���������������������������
���������������������������������
��� Shine 3D ������������������������������������������������������������������
������ PowerShell or UnityEditor ��� ResourceLoader ������ Projector ��������������������������������������������������������������� 10 ������ ProjectorCustom Shader ���������
���������������
������������������������
������������������ 2���3���4���5���6 ������������������������������������������������������������������������������
���������������������
- ���������������5-15 pixels
- ���������������������������=������������+5-10 pixels
- ���������������������������������������
������������������������������������
1. ������������������
������ TestRotation ���������������������������������������������������������������������������������
using System.Collections;using System.Collections.Generic;using UnityEngine;public class TestRotation : MonoBehaviour{ private Vector3 rotationMask = new Vector3(0, 1, 0); // ��������������� private float rotationSpeed = 10.0f; // ���������������������������/������ public GameObject rotateAround; // ������������������ private Transform rotateAroundObject; // ��������������������������������� private void Update() { if (rotateAroundObject) { // ��������������������������������������� transform.RotateAround(rotateAroundObject.transform.position, rotationMask, rotationSpeed * Time.deltaTime); } else { // ��������������������������������� transform.Rotate(new Vector3( rotationMask.x * rotationSpeed * Time.deltaTime, rotationMask.y * rotationSpeed * Time.deltaTime, rotationMask.z * rotationSpeed * Time.deltaTime)); } }}
2. ������������������
������������������������������
���������������������������������X���Z������������������������������������������������������������
if (arrowGO_pos.x < 1 && arrowGO_pos.x > 0.9){ Debug.Log("111");}else{ // ������������������}
������������������������������
���������������������������������������������������������������������������������������������������������������������
Vector3 line_m = new Vector3(mouse_pos.x, 0, mouse_pos.z) - new Vector3(playerGO_pos.x, 0, playerGO_pos.z);Vector3 line_m_ = line_m.normalized;Vector3 line_a = new Vector3(arrowGO_pos.x, 0, arrowGO_pos.z) - new Vector3(centerGO_pos.x, 0, centerGO_pos.z);Vector3 line_a_ = line_a.normalized;if (line_a_.x������ line_m_.x �� 0.1 ��������� ��� z���������������������){ // ������������}else{ // ������������}
������������������������
��������������������������������������� Rotation ��� Position ������������������������������������������������������������������������������������������������������
���������������
public class TestRotation : MonoBehaviour{ private Vector3 rotationMask = new Vector3(0, 1, 0); private float rotationSpeed = 10.0f; public GameObject playerGO; private Transform playerGO_transform; private Vector3 playerGO_pos; // Update ������������������������ void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; Physics.Raycast(ray, out hit, 5000); if (hit.transform) { // ������������������������ mouse_pos = hit.point; // ������������������������ line_m = new Vector3(mouse_pos.x, 0, mouse_pos.z) - new Vector3(playerGO_pos.x, 0, playerGO_pos.z); line_m_ = line_m.normalized; line_a = new Vector3(arrowGO_pos.x, 0, arrowGO_pos.z) - new Vector3(centerGO_pos.x, 0, centerGO_pos.z); line_a_ = line_a.normalized; // ������������������ if (������������) { Debug.Log("111"); } else { // ��������������������� transform.RotateAround(centerGO_pos, rotationMask, rotationSpeed * Time.deltaTime); } } }}
������������������
- ���������PS���������
- PS���������������������������
- PS���������������������
- PS������������������������
������������������������������������ Unity ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
