Camera script relative spherical coordinates

Camera script relative spherical coordinates

以住寫過 spring camera 的文章, 這幾週在繁重的時間表當中終於有點空間可以製作 spherical coordinate 的追蹤系統,

遇到的問題如下

  • 當年應該好好的學習一下 Matrix 及 sin cos tan.. 全忘了, 至少花了 10 多個工時, 就是在搞清楚 spherical 跟 cartesian coordinates 間的關係.
  • 網上查找的都是 Zero (0,0,0) 點轉換, 害我又多花了 20 多個工時才找準動態計算相對坐標的轉換方式, 最後還是靠矇的
  • 系統概念很簡單 hardcode, 作成 extendable 的 api 及 developing ui 才是最麻煩.
  • Unity3D 裡的 camera preview. (Unity you fail me again.)
  • FixUpdate, Update, LateUpdate
  • Lerp 及 Slerp 間的奇怪關係, 其實也不奇怪喇~
  • Cursor control on webplayer

Spherical coordinate

 

基礎系統基本完成,但可加強的地方還有很多, plan for future features.

  1. zoom, polar, azimuthal min/max limit
  2. camera shake
  3. physical force reaction
  4. camera depth
  5. lens effect + HDR
  6. motion blur
  7. transition method

一次完成有點難度而且可用性會降低, 怎樣把這些 feature 製作 oop 元件分割開才可以達到更方便的效果.

 

Camera 的效果如下圖,

  • WASD
  • Mouse 1,2,3,4 button for camera
  • ESC to exist cursor lock.

主要是流暢度及相對坐標的展示,

 

Reference :

  • http://en.wikipedia.org/wiki/Spherical_coordinate_system
  • http://blogs.msdn.com/b/ito/archive/2009/05/01/more-bones-04.aspx

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

*

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料