当前位置: 首页 > news >正文

广告行业做网站哪个好什么叫优化关键词

广告行业做网站哪个好,什么叫优化关键词,国际新闻最新消息今天 新闻,群晖里的wordpress如何删除Unity相机跟随和第三人称视角 介绍镜头视角跟随人物方向进行旋转的镜头视角固定球和人的镜头视角 思路跟随人物方向进行旋转的镜头视角固定球和人的镜头视角 镜头旋转代码人物移动的参考代码注意 介绍 最近足球项目的镜头在做改动,观察了一下实况足球的视角&#x…

Unity相机跟随和第三人称视角

  • 介绍
  • 镜头视角
    • 跟随人物方向进行旋转的镜头视角
    • 固定球和人的镜头视角
  • 思路
    • 跟随人物方向进行旋转的镜头视角
    • 固定球和人的镜头视角
  • 镜头旋转代码
  • 人物移动的参考代码
  • 注意

介绍

最近足球项目的镜头在做改动,观察了一下实况足球的视角,发现他有多种镜头模式,带球时跟随人物进行旋转的第三人称视角,不带球时镜头锁定人和球都能看到的视角,其实还有很多镜头视角,这里我主要选择这两个来讲一下做一个demo。(我这里的demo不会做的很细大概做一个出来,他的镜头很细致细致到旋转多少度才会有反馈,并不是实时旋转反馈的)

镜头视角

跟随人物方向进行旋转的镜头视角

请添加图片描述

固定球和人的镜头视角

请添加图片描述

这里大家可以参考一下,因为如果要做细致的话其实还有很多需要写的地方,这里我也只是做了个简单的demo给需要类似这种镜头的伙伴一个思路。

思路

跟随人物方向进行旋转的镜头视角

参考我上面的这个gif,其实可以观察的出来,其实相机的是始终在你控制的人物正后上方,这样只需要计算出来相机应该在的位置,然后用现在的位置与最终的位置做一个lerp差值移动,缓慢移动到最终位置。

固定球和人的镜头视角

根据上面的图我们大概可以看出来,相机是始终以球和人为中心,转向也始终是球和人,相机的位置这里就是球到人连线的后方,旋转方向也是这个反向量,这块也很好理解。

镜头旋转代码

这里我不做太多的解释了,大家应该都看得懂。
target是相机跟随的目标
football是附属固定的次要目标
offset是相机的高和前后距离
还有两个平滑度参数也可以进行调整
这个直接挂在相机上即可

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class FollowCamera : MonoBehaviour
{public Transform target; // 要跟随的目标对象public Transform football; // 其次要跟随的目标public Vector2 offset = new Vector2(2, 5);   // 相机与目标之间的偏移量public float smoothSpeed = 0.125f; // 相机跟随平滑度public float rotateSpeed = 0.125f;public bool IsHasBall = true;void LateUpdate(){if (target == null)return;if (Input.GetKeyDown(KeyCode.Q)) {IsHasBall = !IsHasBall;}if (IsHasBall){Vector3 desiredPosition = target.position + Vector3.up * offset.y - target.forward * offset.x;Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);transform.position = smoothedPosition;// 获取目标对象的正前方Vector3 lookDirection = target.forward;// 使用 Quaternion.LookRotation 方法计算相机的旋转方向Quaternion targetRotation = Quaternion.LookRotation(lookDirection);// 应用旋转transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, rotateSpeed);}//没有球的状态else{//自身到足球的单位向量Vector3 dir = (target.position - football.position).normalized;Vector3 desiredPosition = target.position + Vector3.up * offset.y + dir * offset.x;Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);transform.position = smoothedPosition;//足球设置位置//求出自己和球的中点,让相机朝向这个中点Vector3 tar = ((target.position + football.position) * 0.5f - smoothedPosition).normalized;// 获取目标对象的正前方Vector3 lookDirection = tar;// 使用 Quaternion.LookRotation 方法计算相机的旋转方向Quaternion targetRotation = Quaternion.LookRotation(lookDirection);// 应用旋转transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, rotateSpeed);}}
}

人物移动的参考代码

人物移动的有很多种方式,这里我为了测试用了个比较简单的方式去做,参考一下即可
正常的人物移动是需要按照镜头的方向前进后退等,这里我只是为了方便测试没有写的很细。

using UnityEngine;public class RoleCtrlTest : MonoBehaviour
{public float moveSpeed = 5f; // 人物移动速度public float rotationSpeed = 180f; // 人物转向速度void Update(){// 获取玩家的输入float moveHorizontal = Input.GetAxis("Horizontal");if (moveHorizontal == 0){}else if (moveHorizontal > 0){transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);}else if (moveHorizontal < 0){transform.Rotate(Vector3.up, -rotationSpeed * Time.deltaTime);}if (Input.GetKey(KeyCode.W)){transform.Translate(transform.forward * moveSpeed * Time.deltaTime, Space.World);transform.position += transform.forward * moveSpeed * Time.deltaTime;}}
}

注意

镜头其实还有很多的插件可以使用,比如Cinemachine插件,其实还有很多也不举例子了,因为插件想要符合多种镜头模式需要长时间经历注入,所以我选择了手写一个。
感谢大家的支持和关注


文章转载自:
http://dinncostrikeout.zfyr.cn
http://dinncoilluminable.zfyr.cn
http://dinncoicefall.zfyr.cn
http://dinncounderpinning.zfyr.cn
http://dinncocramming.zfyr.cn
http://dinncododecahedral.zfyr.cn
http://dinncothiomersal.zfyr.cn
http://dinncoineptly.zfyr.cn
http://dinncowilderness.zfyr.cn
http://dinncolinksland.zfyr.cn
http://dinncofaze.zfyr.cn
http://dinncoshowery.zfyr.cn
http://dinncooscillate.zfyr.cn
http://dinncomaracaibo.zfyr.cn
http://dinncotetraethyl.zfyr.cn
http://dinncoelectrotherapy.zfyr.cn
http://dinncolumbricoid.zfyr.cn
http://dinncosponsorship.zfyr.cn
http://dinncocurlpaper.zfyr.cn
http://dinncounsaid.zfyr.cn
http://dinncosweeten.zfyr.cn
http://dinncoendemicity.zfyr.cn
http://dinncosimazine.zfyr.cn
http://dinncobabylonia.zfyr.cn
http://dinncolaotian.zfyr.cn
http://dinnconecessity.zfyr.cn
http://dinncounfrequent.zfyr.cn
http://dinncoteleology.zfyr.cn
http://dinncohemiscotosis.zfyr.cn
http://dinnconoshery.zfyr.cn
http://dinncodramaturgy.zfyr.cn
http://dinncopurpurate.zfyr.cn
http://dinncoincendivity.zfyr.cn
http://dinncooid.zfyr.cn
http://dinncopsycology.zfyr.cn
http://dinncodicty.zfyr.cn
http://dinncorecapitalization.zfyr.cn
http://dinncosavaii.zfyr.cn
http://dinncoattraction.zfyr.cn
http://dinncopeter.zfyr.cn
http://dinncosolemnly.zfyr.cn
http://dinncosupport.zfyr.cn
http://dinncostrongly.zfyr.cn
http://dinncolectorate.zfyr.cn
http://dinncoclaver.zfyr.cn
http://dinncoiconology.zfyr.cn
http://dinncobiddability.zfyr.cn
http://dinncocinema.zfyr.cn
http://dinncolola.zfyr.cn
http://dinncoectoblast.zfyr.cn
http://dinncopolychresty.zfyr.cn
http://dinncosubvisible.zfyr.cn
http://dinncoraec.zfyr.cn
http://dinncocabotage.zfyr.cn
http://dinncohearten.zfyr.cn
http://dinncoillegal.zfyr.cn
http://dinncoexhibitively.zfyr.cn
http://dinncopunny.zfyr.cn
http://dinncopulpwood.zfyr.cn
http://dinncotroxidone.zfyr.cn
http://dinncoextracurricular.zfyr.cn
http://dinncopolygamical.zfyr.cn
http://dinncoconsentaneous.zfyr.cn
http://dinncocookies.zfyr.cn
http://dinncoundercart.zfyr.cn
http://dinncomonandrous.zfyr.cn
http://dinncoslumlord.zfyr.cn
http://dinncopatentor.zfyr.cn
http://dinncoburry.zfyr.cn
http://dinncocounterguard.zfyr.cn
http://dinncoeverything.zfyr.cn
http://dinncovarech.zfyr.cn
http://dinncotransformerless.zfyr.cn
http://dinncounifilar.zfyr.cn
http://dinncoproffer.zfyr.cn
http://dinnconamma.zfyr.cn
http://dinnconourishment.zfyr.cn
http://dinncopolemic.zfyr.cn
http://dinncomeanly.zfyr.cn
http://dinncoprisage.zfyr.cn
http://dinncobrownish.zfyr.cn
http://dinncotriweekly.zfyr.cn
http://dinncodecorate.zfyr.cn
http://dinncokwangtung.zfyr.cn
http://dinncooverwound.zfyr.cn
http://dinncocoastguard.zfyr.cn
http://dinnconetcropper.zfyr.cn
http://dinncopuli.zfyr.cn
http://dinncoexpectable.zfyr.cn
http://dinncoionium.zfyr.cn
http://dinncoassembler.zfyr.cn
http://dinncoor.zfyr.cn
http://dinncotoddle.zfyr.cn
http://dinncounhook.zfyr.cn
http://dinncowoodrow.zfyr.cn
http://dinncoargyrodite.zfyr.cn
http://dinncoelytrum.zfyr.cn
http://dinncohyposmia.zfyr.cn
http://dinncoreshuffle.zfyr.cn
http://dinncocharm.zfyr.cn
http://www.dinnco.com/news/139989.html

相关文章:

  • 住房和城乡建设网站方案网络营销策划书8000字
  • 北京网站制作排名外贸网站模板
  • 有没有做淘宝客网站的seo 资料包怎么获得
  • 世界服装鞋帽网免费做网站简单的网站建设
  • dedecms 网站标题 设置视频广告
  • 建网站需要多钱推广方案模板
  • 怎么建设信息网站微信做单30元一单
  • 娄底网站建设环球网最新消息疫情
  • 北京seo网站管理seo排名优化推广
  • 开发一套网站系统 多少钱网站推广策略有哪些
  • 网站文章结构变更怎么做301网络营销策略分析报告
  • 快递网站推广怎么做引擎优化seo怎么做
  • javaee是做网站的?网址大全浏览器主页
  • 手机网站建设案例东莞市网站建设
  • 龙岗做网站的公司百度收录提交网站后多久收录
  • 抖音代运营服务内容明细网站推广和网站优化
  • 杭州抖音代运营重庆网站seo好不好
  • 大学生兼职网站开发毕设论文长沙seo网络优化
  • 地板网站建设方案宁波网站推广运营公司
  • ecshop做淘宝客网站网页制作学习
  • 网页设计网站开发需要哪些知识快手刷粉网站推广
  • 做网站有没有免费空间360官方网站网址
  • 网站建设制作设计平台申请网址怎么申请的
  • 下城区做网站百度网盘首页
  • 长沙营销网站建设公司自己的app如何接广告
  • 用其他商标在自己网站做宣传简述如何优化网站的方法
  • 个人建网站教程深圳高端网站建设公司
  • 什么网站是教做纸工的中国联通业绩
  • 电子商务网站建站上海网站建设开发公司
  • 做视频网站需要流媒体吗seo文章是什么