zoukankan      html  css  js  c++  java
  • gameobj move

    float speedFactor = Mathf.Clamp01(target.root.rigidbody.velocity.magnitude / 70.0f);         //Debug.Log(speedFactor);//根据物体的速度变化产生的系数,速度越大,系数越大 camera.fieldOfView = Mathf.Lerp(55, 72, speedFactor); float currentDistance = Mathf.Lerp(7.5f, 6.5f, speedFactor); currentVelocity = currentVelocity.normalized; Vector3 newTargetPosition = target.position + Vector3.up * height;/上面 Vector3 newPosition = newTargetPosition - (currentVelocity * currentDistance);/后面一点距离         //Debug.Log(newPosition); newPosition.y = newTargetPosition.y;//高度保持不变 Vector3 targetDirection = newPosition - newTargetPosition; if(Physics.Raycast(newTargetPosition, targetDirection, out hit, currentDistance, raycastLayers)) newPosition = hit.point; transform.position = newPosition;//摄像机位置变化 transform.LookAt(newTargetPosition);//摄像机朝向汽车方向
  • 相关阅读:
    关于值传递和引用传递
    单例设计模式(创建型模式)
    逻辑分页和物理分页
    java基本数据类型
    Keepalived笔记
    lvs,HAProxy,nginx简单笔记
    限流, 熔断,降级笔记
    redis事务之watch
    Redis-Sentinel
    正式入驻博客园
  • 原文地址:https://www.cnblogs.com/51ss/p/3245815.html
Copyright © 2011-2022 走看看