character_anim/Readme.md

184 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

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
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
* 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`:
* 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`:
* 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
## Configuration
<!--modlib:conf:2-->
### `default`
#### `arm_right`
##### `radius`
2021-10-10 03:32:24 -07:00
Right arm spin radius
* Type: number
* Default: `10`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
##### `speed`
2021-10-10 03:32:24 -07:00
Right arm spin speed
* Type: number
* Default: `1000`
2022-05-13 03:18:44 -07:00
* &gt; `0`
* &lt;= `10000`
##### `yaw`
###### `max`
2021-10-10 03:32:24 -07:00
Right arm yaw (max)
* Type: number
* Default: `160`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
###### `min`
2021-10-10 03:32:24 -07:00
Right arm yaw (min)
* Type: number
* Default: `-30`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
#### `body`
##### `turn_speed`
2021-10-10 03:32:24 -07:00
Body turn speed
* Type: number
* Default: `0.2`
2022-05-13 03:18:44 -07:00
* &gt; `0`
* &lt;= `1000`
#### `head`
##### `pitch`
###### `max`
2021-10-10 03:32:24 -07:00
Head pitch (max)
* Type: number
* Default: `80`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
###### `min`
2021-10-10 03:32:24 -07:00
Head pitch (min)
* Type: number
* Default: `-60`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
##### `yaw`
###### `max`
2021-10-10 03:32:24 -07:00
Head yaw (max)
* Type: number
* Default: `90`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
###### `min`
2021-10-10 03:32:24 -07:00
Head yaw (min)
* Type: number
* Default: `-90`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
##### `yaw_restricted`
###### `max`
2021-10-10 03:32:24 -07:00
Head yaw restricted (max)
* Type: number
* Default: `45`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
###### `min`
2021-10-10 03:32:24 -07:00
Head yaw restricted (min)
* Type: number
* Default: `0`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
##### `yaw_restriction`
2021-10-10 03:32:24 -07:00
Head yaw restriction
* Type: number
* Default: `60`
2022-05-13 03:18:44 -07:00
* &gt;= `-180`
* &lt;= `180`
### `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
* *Clearing the override* by setting both `rotation` and `position` to `nil` ("unset_bone_position")