Animating a model: Difference between revisions
Jump to navigation
Jump to search
Tip:Layers are calculated each frame in order of
No edit summary |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This page is for programmers. Animators should see [[$sequence]] and/or [[Choreography creation]]. | |||
== | == Main Sequence == | ||
''All <code>[[CBaseAnimating]]</code> entities can play an animation.'' | |||
; <code>SetSequence([[int]])</code> | |||
: Changes an entity's current [[skeletal animation]] sequence. If the sequence is already playing, and is not marked as a [[$sequence#Simple|loop]], it will restart. | |||
; <code>SetSequenceByName([[char]]*)</code> | ; <code>SetSequenceByName([[char]]*)</code> | ||
: Searches for a sequence by name. Avoid doing this if you can. | : Searches for a sequence by name. Avoid doing this if you can. | ||
Line 20: | Line 24: | ||
: Gets a <code>[[Vector]]</code> which describes the sequence's [[$sequence#Simple|extracted motion]] over its entire duration. | : Gets a <code>[[Vector]]</code> which describes the sequence's [[$sequence#Simple|extracted motion]] over its entire duration. | ||
== Blending == | == Blending sequences == | ||
If your entity inherits from <code>CBaseAnimatingOverlay</code> you can blend up to 15 sequences on top of the standard one. | ''If your entity inherits from '''<code>CBaseAnimatingOverlay</code>''' you can blend up to 15 sequences on top of the standard one.'' | ||
{{tip|Layers are | {{tip|Layers are calculated each frame in order of <code>priority</code>.}} | ||
; <code>[[int]] AddGesture([[Activity]] activity, [[bool]] autokill=true)</code> | ; <code>[[int]] AddGesture([[Activity]] activity, [[bool]] autokill=true)</code> | ||
Line 36: | Line 40: | ||
: As <code>AddGesture()</code>, but doesn't require an activity. | : As <code>AddGesture()</code>, but doesn't require an activity. | ||
; <code>[[int]] AddLayeredSequence([[int]] sequence, [[int]] priority)</code> | ; <code>[[int]] AddLayeredSequence([[int]] sequence, [[int]] priority)</code> | ||
: Directly adds a new layer and makes it play the given sequence. Return value is the layer's index, or -1 on failure. | : Directly adds a new layer and makes it play the given sequence. Return value is the layer's index, or -1 on failure. Will ''not'' autokill. | ||
; <code>SetLayerAutokill([[int]] layer, [[bool]] autokill)</code> | ; <code>SetLayerAutokill([[int]] layer, [[bool]] autokill)</code> | ||
Line 46: | Line 50: | ||
: Directly access an animation layer. You will need to do this in order to kill one manually. | : Directly access an animation layer. You will need to do this in order to kill one manually. | ||
[[Category: | == Networked animation == | ||
See <code>[[m_PlayerAnimState]]</code>. | |||
== Choreography == | |||
''[[Choreography]] is the playback of pre-authored acting scenes.'' | |||
{{todo}} | |||
=== Facial expression === | |||
{{todo}} | |||
[[Category:Programming]] |
Latest revision as of 13:36, 16 September 2011
This page is for programmers. Animators should see $sequence and/or Choreography creation.
Main Sequence
All CBaseAnimating
entities can play an animation.
SetSequence(int)
- Changes an entity's current skeletal animation sequence. If the sequence is already playing, and is not marked as a loop, it will restart.
SetSequenceByName(char*)
- Searches for a sequence by name. Avoid doing this if you can.
int SelectWeightedSequence(Activity)
- Selects an appropriate sequence for the given activity. Pass the return value to
SetSequence()
.
SetCycle(float)
- Changes the frame of the current sequence.
SetPlaybackRate(float)
- Changes the sequence's speed. The argument is a normalised percentage.
GetSequenceLinearMotion(int sequence, Vector* output)
- Gets a
Vector
which describes the sequence's extracted motion over its entire duration.
Blending sequences
If your entity inherits from CBaseAnimatingOverlay
you can blend up to 15 sequences on top of the standard one.

priority
.int AddGesture(Activity activity, bool autokill=true)
- Helper which creates a layer with the given activity. Return value is the layer's index, or -1 on failure.
void RestartGesture(Activity activity, bool addifmissing=true, bool autokill=true)
- Resets the first layer playing the given activity to its first frame. Optionally creates a new layer with the gesture if nothing is found.
int FindGestureLayer(Activity activity)
- Searches for a active layer playing the given activity. Returns -1 on failure.
int AddGestureSequence(int sequence, bool autokill=true)
- As
AddGesture()
, but doesn't require an activity. int AddLayeredSequence(int sequence, int priority)
- Directly adds a new layer and makes it play the given sequence. Return value is the layer's index, or -1 on failure. Will not autokill.
SetLayerAutokill(int layer, bool autokill)
- A layer, by default, persists after its sequence is over. Setting autokill causes it to be removed automatically (even if it loops) once it's through.
SetLayerDuration(int layer, float duration)
- Adjusts the framerate of the given layer so that it lasts for the given number of seconds.
CAnimationLayer* GetAnimOverlay(int)
- Directly access an animation layer. You will need to do this in order to kill one manually.
Networked animation
See m_PlayerAnimState
.
Choreography
Choreography is the playback of pre-authored acting scenes.
[Todo]
Facial expression
[Todo]