zoukankan      html  css  js  c++  java
  • camera render texture 游戏里的监控视角

    Camera里:

       新建render texture并拖入到target texture里

       新建材质球 拖入render texture      camera里的视角会在材质球上出现

       新建一个plane 将材质球拖入片中,片上会显示出camera里的场景

       render texture将camera与material联系起来,将camera的视角播放在material上,plane以这个material为材质,实现监控视角。

    ps:

    Normal map 法线效果图   增强凹凸感和光线变化的立体效果

    图片的效果和材质球的设置(shader)以及图片本身的设置有关

    坐标系

     屏幕坐标系  右上角(1024, 768)

     视窗坐标系  右上角(1, 1)

    屏幕坐标转世界坐标 z轴为物体到camera的距离

    屏幕坐标转射线     z轴忽略

    cube跟随鼠标(cube距cameraz轴距离为9)

    cube.transform.position = camera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 9)) ;

    鼠标位置画射线

    Ray ray = camera.ScreenPointToRay(Input.mousePosition) ;
    Debug.DrawRay(ray.origin, ray.direction, Color.red) ;

    RaycastHit  获取射线碰撞

    Ray ray = camera.ScreenPointToRay(Input.mousePosition) ;
    RaycastHit hit ;
    Debug.DrawRay(ray.origin, ray.direction*100, Color.red) ;
    if(Physics.Raycast(ray, out hit)){
      print (hit.transform);
    }

    hit.transform    碰撞物体名字

    hit.transform.position  碰撞物体位置

    hit.point  碰撞射线照射位置

  • 相关阅读:
    mitm iptables ssltrip set ferret hamster
    SQL注入的常用函数和语句
    SQL注入的字符串连接函数
    SQL注入的分类
    DNS配置详解
    Linux的任务计划--cron入门
    Linux文件系统层次结构标准
    Linux的awk命令
    Linux的sed命令
    Linux的find命令
  • 原文地址:https://www.cnblogs.com/xiaolongchase/p/3276992.html
Copyright © 2011-2022 走看看