using system;
using unityengine;
namespace unitystandardassets._2d
// update is called once per frame
private
void
update()
else
//目標前方位置 = 目標位置 + 前方位置 + z軸偏移
vector3 aheadtargetpos = target.position + m_lookaheadpos + vector3.forward*m_offsetz;
/*我們來看下這個函式 vector3.smoothdamp 平滑阻尼
smoothdamp(current, target, ref currentvelocity, smoothtime, maxspeed, deltatime)
current 當前的位置
target 我們試圖接近的位置
currentvelocity 當前速度,這個值由你每次呼叫這個函式時被修改
smoothtime 到達目標的大約時間,較小的值將快速到達目標
maxspeed 選擇允許你限制的最大速度
deltatime 自上次呼叫這個函式的時間。預設為time.deltatime
*/vector3 newpos = vector3.smoothdamp(transform.position, aheadtargetpos, ref m_currentvelocity, damping);
//將新位置賦給鏡頭位置
transform.position = newpos;
//更新目標位置
m_lasttargetposition = target.position;}}
}
Camera2 API Video 錄影過程
在之前的文章已經詳細講解過關於camera的open整個過程,下面我們在來說說video的過程 還記得cameradevice類嗎?cameradevice的reatecapturerequest int templatetype 方法建立capturerequest.builder。templat...
Camera2教程之2 實現預覽
public class usecamera2 2activity extends catch cameraacces ception e override public void onsu cetexturesizechanged nonnull su cetexture su ce,int wi...
Camera2例子鏈結
最後,在網上發現幾個使用camera api2開發的例項程式,總結一下方便後續參考 1.camera2 basic 演示如何使用camera2 api基本功能的demo。你可以從中學會如何遍歷相機裝置的所有特性,顯示預覽 以及拍照。2.camera2 video l camera是乙個開源的實驗性質...