[Unity&特效]使用Projector投影仪来制作角色脚下的特效圆环以及技能指示器skill indicator
发布日期:2021-05-09 11:51:51 浏览次数:22 分类:精选文章

本文共 5086 字,大约阅读时间需要 16 分钟。

���������Unity���������������������������

���������������������������������

��� Shine 3D ������������������������������������������������������������������

������ PowerShell or UnityEditor ��� ResourceLoader ������ Projector ��������������������������������������������������������������� 10 ������ ProjectorCustom Shader ���������

���������������

  • ������������������������������������������������������������������
  • ������������������������ Projector ������������������������������������������������������������������������
  • ��������������������������������������������� Sample Object���������������������������������������������
  • ���������������������������������������������������������������������������������������������
  • ������������������������

    ������������������ 2���3���4���5���6 ������������������������������������������������������������������������������

  • ��������������������� Paint ������������������������������������������������
  • ���������������������������������������������������������������������
  • ������������������������������������������������������������������������
  • ���������������������������������������������������������������������
  • ���������������������

    • ���������������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);
    }
    }
    }
    }

    ������������������

    ������������������������������������ Unity ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

    上一篇:[Unity]物体坐标系和世界坐标系的方向变量以及说明
    下一篇:[Unity]适合独立开发者的几款画图软件

    发表评论

    最新留言

    路过,博主的博客真漂亮。。
    [***.116.15.85]2025年04月11日 02时46分34秒