Overview
Animations bring your models to life. BetterModel’s animation system supports:- Keyframe-based animations from BlockBench
- Multiple animation layers and blending
- Per-player animations
- Dynamic animation speed and conditions
- Smooth interpolation and transitions
Animation Basics
Animations are defined in your.bbmodel file and loaded automatically with the model.
Playing Animations
src/main/java/com/example/BasicAnimation.java
Animation Types
Animations can loop or play once:AnimationIterator.Type
Animation repeats indefinitely until stopped
AnimationIterator.Type
Animation plays once then automatically stops
AnimationIterator.Type
Animation plays once and holds the last frame
Animation Modifier
TheAnimationModifier controls animation playback behavior.
Basic Usage
src/main/java/com/example/AnimationModifier.java
Lerp Transitions
Smooth transitions between animations:Lerp (linear interpolation) values are in Minecraft ticks (1 tick = 50ms).
Animation Speed
Conditional Animations
Play animations only when conditions are met:Animation Override
Control whether new animations can interrupt current ones:Per-Player Animations
Different animations for different players:src/main/java/com/example/PerPlayerAnimation.java
Per-player animations use more resources. Use sparingly and only when necessary.
Stopping Animations
Stop by Name
Replace Animations
Replace one animation with another:Animation Queries
Check animation state:Advanced: TrackerAnimation
Create reusable animation sequences:src/main/java/com/example/TrackerAnimation.java
Animation Best Practices
Use appropriate lerp times
Use appropriate lerp times
Smooth transitions improve visual quality:
Chain animations with callbacks
Chain animations with callbacks
Create animation sequences:
Optimize per-player animations
Optimize per-player animations
Use per-player animations sparingly:
Use predicates for state-based animations
Use predicates for state-based animations
Conditional animations for reactive behavior:
Match animation speed to entity speed
Match animation speed to entity speed
Dynamic speed for realistic movement:
Example: State Machine
src/main/java/com/example/AnimationStateMachine.java
Example: Combat Animations
src/main/java/com/example/CombatAnimations.java
See Also
Trackers
Managing tracker lifecycle
Bones & Hitboxes
Per-bone animation control
Conditional Animations
Dynamic animations with conditions
API Reference
Complete AnimationModifier API
