Skip to main content

Featured

Build docker image from multiple build contexts

Build docker image from multiple build contexts Building a docker image requires specifying a source of truth to include in the image from a local directory or a remote git repository. In the previous version, the docker BuildKit allows users to specify the build context from a single source of truth only. However, the engineers may need to have the context from different locations based on the type of files. For instance, icons, images or other resources that are not included in the same package, including the resource from other docker images. Fortunately, the Docker Buildx toolkit supports multiple build context flag for Docker 1.4. Let's learn how to use this new feature. The following list is a shortcut for jumping into a specific topic handy. What version of Docker is this tutorial targeting? How to specify the version of Dockerfile frontend? Ho

[Unity]Animation Component - Attributes

參考資料:Scripting > Runtime Classes > Animation

         跟據官方的說法,這個元件是用來做動畫播放使用。而整個動畫系統是利用「權重」的方式來進行動畫的播放。相關內容可以參考Unity Manual > Animation Scripting。底下針對Animation所提供的屬性來進行說明。

1.clip(Animation Clip)
        在沒有指定播放的clip時進行播放時,所會播放的Animation clip。即在Script內呼叫Animation.Play()時,Animation Component就會播放此組clip。在Inspector底下所看到的屬性如圖.1的紅框框選處。

圖1.Animation設定介面

2.playAutomatically:(bool)
        這個屬性是用來決定在GameObject啟動(Active)時,是否要播放預設的Animation Clip。也就是此值為true時,Animation System則會在GameObject設為啟動(Active)之後,自動播放Animation.clip的動畫內容。在Inspector底下所看到的屬性如圖.1的綠框框選處。

3.wrapMode:(WrapMode)
        此屬性是用來決定當Animation Clip播放完畢時,接下來要做何種處理。可以參考[Unity]Animation WarpMode

4.isPlaying:(bool)
        此屬性可用來判斷Animation Clip是否已經被播放完畢。當此屬性為true時,即是指定的Animation Clip還在播放中;反之為false時,則代表指定的Animation Clip已經停止播放了。

5.this[string name]:(AnimationState)
        此Indexer可以透過Animation Clip的名稱來取得其所用到的AnimationState。因此如有需要修改AnimationState的屬性時,就可以使用此屬性。說明測試也可以參考[Unity]AnimationState

6.animatePhysics:(bool)
        這個屬性是用來設定Animation播放時,會不會受到物理引擎的影響。當此屬性設為true時,Animation Clip播放時,就會被加到物理引擎內進行計算。但如要使此設定有效時,還必需先在要播放Animation Clip的GameObject上加上RigidBody,並設定成會受物理引擎影響。在Inspector底下所看到的屬性如圖1.的黃框框選處。

Note:目前測試在播放水平移動的動畫時,再加上重力影響時,高度座標的的確是有所改變。
         但其變化量比無播放動畫時的狀況還要來的小很多。

7.cullingType:(AnimationCullingType)
        跟據官的說法,當culling被起動時(也就是設定不是AnimationCullingType.AlwaysAnimate),Unity會在animation不會被使用者看到時,自動的停止AnimatoinClip的播放。因此這個設定是用來節省效能消耗。當動畫元件被culled的時候,AnimatoinState、Event或是Sample Animation(可以參考animation.sample() usage)都不會有做用。在Inspector底下所看到的屬性如圖1.的紫框框選處。(不過目前測試沒有成功的試出來。)

8.localBounds:(Bounds)
      此屬性為Animation的動畫元件(animation component)在區域座標(local space)下的Axis-aligned minimum bounding box(AABB)。跟據官方的說法,此屬性在預設的條件下,是跟據動畫狀態(animation state,也就是所附加的Animation Clip)來計算的。而使用者也可以透過重新指定數值來變更目前的localBounds。
 
      如有要數值更改回原設定值,就僅需將Animation.cullingType設定為AnimationCullingType.BasedOnClipBounds即可。在Animation.cullingType沒有設定為AnimationCullingType.BasedOnClipBounds或是AnimationCullingType.BasedonUse的時候,此屬性是沒有被定義的。然而當Animation.localBounds被設定時,系統就會自動將Animation.cullingType設定為AnimationCullingType.BasedOnUserBounds。

Comments

Popular Posts