# .animation Format

This page will be an approximate breakdown on the current known information on the `.animation` file format. Used in modern Diesel games such as Payday 2, Payday: The Heist, and RAID: World War II.

A key thing to note is this format is compressed using level 6 zlib compression and must be uncompressed before parsing, and compressed once again after any changes. The uncompressed file size is appended to the end of this data.

---

## Headers
### Main File Header
* Unknown - (32 Bit) - Almost always `85 CC 83 08`.
* Unknown - (64 Bit) - Almost always just `00 00 00 00 00 00 00 00`.
* File Size - (32 Bit Unsigned Integer)
* Animation Length in Seconds - (32 Bit Float)

### Object Names Header
* Number of Object Names - (32 Bit Unsigned Integer)
* Offset for Object Names - (32 Bit Unsigned Integer)

###  Unknowns Header
* Number of Unknowns - (32 Bit Unsigned Integer)
* Offset for Unknowns - (32 Bit Unsigned Integer)

### Event Triggers Header
* Number of Event Triggers - (32 Bit Unsigned Integer)
* Offset for Event Triggers - (32 Bit Unsigned Integer)

###  Object Positions Header
* Number of Object Positions - (32 Bit Unsigned Integer)
* Offset for Object Positions - (32 Bit Unsigned Integer)

###  Object Rotations Header
* Number of Object Rotations - (32 Bit Unsigned Integer)
* Offset for Object Rotations  - (32 Bit Unsigned Integer)
---

## Object Names
> Note: The order of these matches up to Object Positions and Object Rotations.

**STARTING AT** *(Offset for Object Names)* **FOR EACH** *(Number of Object Names)*

* Offset of Object Name - (32 Bit Unsigned Integer)
* **GOTO** *(Offset of Object Name)*
* Object Name - (String terminated with a null character.)
---

## Unknowns
**STARTING AT** *(Offset for Unknowns)* **FOR EACH** *(Number of Unknowns)*

* This hasn't actually shown up in any files I've seen, so no idea about the format or even the size.
---

## Event Triggers
**STARTING AT** *(Offset for Event Triggers)* **FOR EACH** *(Number of Event Triggers)*

* Percentage of Animation Length - (32 Bit Float)
* Offset of Event Trigger Name - (32 Bit Unsigned Integer)
* **GOTO** *(Offset of Event Name)*
* Event Trigger Name - (String terminated with a null character.)
---

## Object Positions
> Note: The order of these matches up to Object Names and Object Rotations. Positions are relative to the objects parent object.

**STARTING AT** *(Offset for Object Positions)* **FOR EACH** *(Number of Object Positions)*

* Position Format - (32 Bit) - Almost always `E0 86 C6 1D` or `B2 CF 96 11`.
* Offset of Object Position - (32 Bit Unsigned Integer)
* **GOTO** *(Offset of Object Position)*
* Unknown - (32 Bit) - Almost always just `00 00 00 00`.
* Number of Positions - (32 Bit Unsigned Integer)
* Offset of Positions - (32 Bit Unsigned Integer) - This almost always just points to the next 4 bytes.
* **STARTING AT** *(Offset for Object Positions)* **FOR EACH** *(Number of Object Positions)*
	* **IF** *(Position Format)* **IS** `E0 86 C6 1D`
      * Time in Seconds - (32 Bit Float)
      * X Coordinate - (16 Bit Unsigned Short) (Quantized value -10m to 10m)
      * Y Coordinate - (16 Bit Unsigned Short) (Quantized value -10m to 10m)
      * Z Coordinate - (16 Bit Unsigned Short) (Quantized value -10m to 10m)
      * Unknown - (16 Bit) - Almost always just `00 00`.

	* **IF** *(Position Format)* **IS** `B2 CF 96 11`
		* Time in Seconds - (32 Bit Float)
        * X Coordinate - (32 Bit Float)
        * Y Coordinate - (32 Bit Float)
        * Z Coordinate - (32 Bit Float)
        * Unknown - (32 Bit) - Almost always just `00 00 00 00`.
---

## Object Rotations
> Note: The order of these matches up to Object Names and Object Positions. Rotations are relative to the objects parent object.

**STARTING AT** *(Offset for Object Rotations)* **FOR EACH** *(Number of Object Rotations)*

* Rotation Format - (32 Bit) - Almost always `B6 92 FB 9D` or `5C B8 EC 96`.
* Offset of Object Rotation - (32 Bit Unsigned Integer)
* **GOTO** *(Offset of Object Rotation)*
* Unknown - (32 Bit) - Almost always just `00 00 00 00`.
* Number of Rotations - (32 Bit Unsigned Integer)
* Offset of Rotations - (32 Bit Unsigned Integer) - This almost always just points to the next 4 bytes.
* **STARTING AT** *(Offset for Object Positions)* **FOR EACH** *(Number of Object Positions)*
	* **IF** *(Rotation Format)* **IS** `B6 92 FB 9D`
		* Time in Seconds - (32 Bit Float)
		* X Coordinate - (32 Bit Float)
		* Y Coordinate - (32 Bit Float)
		* Z Coordinate - (32 Bit Float)
		* W Coordinate - (32 Bit Float).
    
    * **IF** *(Rotation Format)* **IS** `5C B8 EC 96`
		* Time in Seconds - (32 Bit Float)
        * X - (8 Bit) - (Fixed Point???)
        * Y - (8 Bit) - (Fixed Point???)
        * Z - (8 Bit) - (Fixed Point???)
        * W - (8 Bit) - (Fixed Point???)
        
    * **IF** *(Rotation Format)* **IS** `BA 69 1A E9`
		* Time in Seconds - (32 Bit Float)
		* X Coordinate - (32 Bit Float)
		* Y Coordinate - (32 Bit Float)
		* Z Coordinate - (32 Bit Float)
		* W Coordinate - (32 Bit Float)
        * Unknown - (32 Bit) - Almost always just `00 00 00 00`.
---