2020-09-20 06:16:19 -07:00
# Character Animations (`character_anim`)
2020-09-20 06:15:39 -07:00
2020-09-20 06:16:19 -07:00
Animates the character. Resembles [`playeranim` ](https://github.com/minetest-mods/playeranim ) and [`headanim` ](https://github.com/LoneWolfHT/headanim ).
2020-09-20 06:15:39 -07:00
## About
2021-10-10 03:28:34 -07:00
Depends on [`modlib` ](https://github.com/appgurueu/modlib ). Code written by Lars Mueller aka LMD or appguru(eu) and licensed under the MIT license.
2020-09-20 06:15:39 -07:00
2020-09-20 08:22:26 -07:00
## Screenshot
2020-09-20 11:46:52 -07:00
![Image ](screenshot.png )
2020-09-20 08:22:26 -07:00
2020-09-20 06:15:39 -07:00
## Links
2020-09-20 06:16:19 -07:00
* [GitHub ](https://github.com/appgurueu/character_anim ) - sources, issue tracking, contributing
2020-09-20 06:15:39 -07:00
* [Discord ](https://discordapp.com/invite/ysP74by ) - discussion, chatting
2020-09-20 08:31:11 -07:00
* [Minetest Forum ](https://forum.minetest.net/viewtopic.php?f=9&t=25385 ) - (more organized) discussion
2020-09-20 06:16:19 -07:00
* [ContentDB ](https://content.minetest.net/packages/LMD/character_anim ) - releases (cloning from GitHub is recommended)
2020-09-20 06:15:39 -07:00
2020-11-29 06:24:42 -08:00
## Features
2020-09-20 06:15:39 -07:00
* Animates head, right arm & body
2021-10-10 03:28:34 -07:00
* Also provides support for arbitrary player models, as long as `Head` , `Arm_Right` & `Body` bones exist
2020-09-20 06:15:39 -07:00
* Advantages over `playeranim` :
2022-05-15 06:35:48 -07:00
* Extracts exact animations and bone positions from b3d models at runtime (no complex installation)
2020-09-20 06:16:19 -07:00
* Also animates attached players (with restrictions on angles)
2020-09-20 06:15:39 -07:00
* Advantages over `headanim` :
2022-05-15 06:35:48 -07:00
* Provides compatibility back until Minetest 0.4.x (as opposed to `headanim` supporting only 5.3+)
2020-09-20 06:15:39 -07:00
* Head angles are clamped, head can tilt sideways
* Animates right arm & body as well
2021-03-31 15:56:32 -07:00
## Configuration
<!-- modlib:conf:2 -->
### `default`
#### `arm_right`
##### `radius`
2021-10-10 03:32:24 -07:00
Right arm spin radius
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `10`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
##### `speed`
2021-10-10 03:32:24 -07:00
Right arm spin speed
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `1000`
2022-05-13 03:18:44 -07:00
* > `0`
* < = `10000`
2021-03-31 15:56:32 -07:00
##### `yaw`
###### `max`
2021-10-10 03:32:24 -07:00
Right arm yaw (max)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `160`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
###### `min`
2021-10-10 03:32:24 -07:00
Right arm yaw (min)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `-30`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
#### `body`
##### `turn_speed`
2021-10-10 03:32:24 -07:00
Body turn speed
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `0.2`
2022-05-13 03:18:44 -07:00
* > `0`
* < = `1000`
2021-03-31 15:56:32 -07:00
#### `head`
##### `pitch`
###### `max`
2021-10-10 03:32:24 -07:00
Head pitch (max)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `80`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
###### `min`
2021-10-10 03:32:24 -07:00
Head pitch (min)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `-60`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
##### `yaw`
###### `max`
2021-10-10 03:32:24 -07:00
Head yaw (max)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `90`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
###### `min`
2021-10-10 03:32:24 -07:00
Head yaw (min)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `-90`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
##### `yaw_restricted`
###### `max`
2021-10-10 03:32:24 -07:00
Head yaw restricted (max)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `45`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
###### `min`
2021-10-10 03:32:24 -07:00
Head yaw restricted (min)
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `0`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
##### `yaw_restriction`
2021-10-10 03:32:24 -07:00
Head yaw restriction
2021-03-31 15:56:32 -07:00
* Type: number
* Default: `60`
2022-05-13 03:18:44 -07:00
* > = `-180`
* < = `180`
2021-03-31 15:56:32 -07:00
### `models`
Other models, same format as `default` model
2021-10-10 04:18:09 -07:00
<!-- modlib:conf -->
## API
Minetest's `player:set_bone_position` is overridden so that it still works as expected.
### `character_anim.set_bone_override(player, bonename, position, rotation)`
The signature resembles that of `set_bone_position` . `bonename` must be a string. The following additional features are provided:
* Using it like `set_bone_position` by setting `rotation` and `position` to non-`nil` values and using `""` to set the root bone
* *Setting only the bone position* by setting `rotation` to `nil` - bone rotation will then be model-animation-determined
* *Setting only the bone rotation* by setting `position` to `nil` - bone position will then be model-animation-determined
2022-05-15 06:35:48 -07:00
* *Clearing the override* by setting both `rotation` and `position` to `nil` ("unset_bone_position")