Plays user-defined animation sequence with optional transition blending (mode: 0=stop, 1=loop, 2=pingpong, 3=once).
Takes entity (animated mesh entity handle), mode (playback mode 0-3), sequenceIndex (sequence ID defined by b3dSetAnimSeq, 1-based), transition (blend time in seconds, 0.0 = instant, 0.2-0.5 typical for smooth transitions).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
entityInt
modeInt
sequenceIndexInt
transitionDouble
Returns
Void
Quick Summary
Plays user-defined animation sequence with optional transition blending (mode: 0=stop, 1=loop, 2=pingpong, 3=once).
Takes entity (animated mesh entity handle), mode (playback mode 0-3), sequenceIndex (sequence ID defined by b3dSetAnimSeq, 1-based), transition (blend time in seconds, 0.0 = instant, 0.2-0.5 typical for smooth transitions).
Returns nothing.
Technical Exegesis...
Plays user-defined animation sequence with optional transition blending (mode: 0=stop, 1=loop, 2=pingpong, 3=once). Takes entity (animated mesh entity handle), mode (playback mode 0-3), sequenceIndex (sequence ID defined by b3dSetAnimSeq, 1-based), transition (blend time in seconds, 0.0 = instant, 0.2-0.5 typical for smooth transitions). Returns nothing. Looks up AnimSequence in entity.animatedMesh.
Plays user-defined animation sequence with optional transition blending (mode: 0=stop, 1=loop, 2=pingpong, 3=once). Takes entity (animated mesh entity handle), mode (playback mode 0-3), sequenceIndex (sequence ID defined by b3dSetAnimSeq, 1-based), transition (blend time in seconds, 0.0 = instant, 0.2-0.5 typical for smooth transitions). Returns nothing. Looks up AnimSequence in entity.animatedMesh.sequences map (using sequenceIndex), sets playback state (playing/looping/pingPong/speed from sequence), optionally blends from current pose to new animation (transition parameter, linear interpolation over time). Use to play character animations (walk/run/idle sequences defined by b3dSetAnimSeq), switch between animations smoothly (transition blending prevents abrupt pose changes), or control playback behavior (loop for walk, once for attack, pingpong for breathing). Playback modes: mode 0 = stop (stops animation, freezes at current frame, playing = false), mode 1 = loop (repeats from start after end, typical for walk/run/idle, looping = true), mode 2 = pingpong (reverses at end, plays forward then backward, typical for breathing/looking, pingPong = true), mode 3 = once (plays once and stops, typical for attacks/jumps, looping = false). Transition blending: if transition > 0.0 stores previous joint transforms (captures current pose before switch), sets transitionDuration and transitionTime (countdown timer for blend), linearly interpolates (lerps) between previous and new pose each frame (smooth transition over duration), if transition = 0.0 instant switch (no blending, animation snaps to new pose immediately). Use cases: (1) Character locomotion (If walking Then b3dAnimateSeq(player, 1, 2, 0.3) loop walk with 0.3s transition), (2) Attack animation (b3dAnimateSeq(player, 3, 5, 0.1) play attack once with quick blend), (3) Idle breathing (b3dAnimateSeq(npc, 2, 1, 0.5) pingpong idle with slow blend), (4) Stop animation (b3dAnimateSeq(entity, 0, 0, 0.0) freeze at current frame). Common patterns: walk = b3dAnimateSeq(player, 1, 2, 0.3) loop walk sequence 2 with 0.3s blend; attack = b3dAnimateSeq(player, 3, 10, 0.1) once attack sequence 10 with quick 0.1s blend; stop = b3dAnimateSeq(player, 0, 0, 0.0) stop playback. Typical transition times: instant (0.0s, no blend, snap to new pose), quick (0.1-0.2s, fast transitions for reactive animations like attacks), smooth (0.3-0.5s, typical for locomotion transitions walk->run), slow (0.5-1.0s, gradual blend for dramatic effect). Sequence playback: uses sequence.speed from b3dSetAnimSeq (playback multiplier, independent speed per sequence), plays within sequence.startTime to sequence.endTime range (frame range defined in SetAnimSeq), currentTime advances each frame (engine updates automatically, speed x deltaTime). Playback state: sets playing = true (animation active, updates each frame), sets looping/pingPong based on mode (affects behavior at sequence end), sets currentSequenceIndex = sequenceIndex (tracks which sequence playing, for b3dAnimSeq query), sets playDirection = 1.0 forward (pingpong mode alternates direction). Validation: only affects ENTITY_ANIMATED_MESH (non-animated entities ignored), silent if entity not found (invalid handle or wrong type, no error), checks sequence exists (if sequenceIndex not in sequences map, ignores, prints debug message), mode clamped (0-3 range, mode 0 = stop always works). Previous pose capture: if transition > 0.0 captures joint transforms (previousJointTransforms array, copy of current skeleton pose), if transition = 0.0 skips capture (no blend needed, saves memory and CPU). Animation blending implementation: UpdateAnimations function (engine per-frame update, advances currentTime), if transitionTime > 0.0 blends (lerp factor = 1.0 - transitionTime/transitionDuration, interpolates joint matrices), decrements transitionTime by deltaTime (countdown to 0, blend finishes when timer expires), when transitionTime <= 0.0 blend complete (uses only new animation, previousJointTransforms cleared). Related: b3dSetAnimSeq defines sequence (must call first to create sequence, then use this function to play), b3dPauseAnimSeq pauses playback (freezes currentTime, playing = false, resume with b3dResumeAnimSeq), b3dResumeAnimSeq resumes playback (continues from current position, playing = true), b3dAnimate plays frame range (alternative, direct frame playback without sequences), b3dAnimating queries playback state (returns 1 if playing, 0 if stopped), b3dAnimSeq queries current sequence (returns sequenceIndex currently playing).