Go to file
Robert Zenz cd606db510 Slightly beveled the shoulders. 2016-01-17 15:11:49 +01:00
deps Updated dependencies. 2015-11-17 20:59:35 +01:00
doc Fixed naming collision. 2015-12-19 12:14:28 +01:00
mods Slightly beveled the shoulders. 2016-01-17 15:11:49 +01:00
.gitmodules Added utils as dependency. 2015-09-16 20:24:39 +02:00
LICENSE Added the player model and basic files. 2015-09-15 22:49:49 +02:00
LICENSE.models Added the player model and basic files. 2015-09-15 22:49:49 +02:00
LICENSE.textures Added the player model and basic files. 2015-09-15 22:49:49 +02:00
Makefile Updated Makefile. 2015-09-20 13:21:43 +02:00
README Added an interval configuration. 2016-01-02 11:51:07 +01:00
README.md Added the player model and basic files. 2015-09-15 22:49:49 +02:00

README.md

minetest-australopithecus-player-model

A minetest mod that provides a player model.

Features

  • A model with elbows and knees.
  • Animations are toned down.
  • By default comes with the animations: digging, laying, sitting, standing, walking, walking/digging.
  • An API allows to easily extend the mod with further, specific animations and also change settings of the players (like the texture used).
  • Completely configurable from the configuration.

License

The code is licensed under 2 clause BSD, the artwork and models are licensed under Creative Commons 4.0 Attribution.

Model history:

  1. MiceaKitsune, original model, licensed under WTFPL.
  2. stu, addition of elbows and knees, licensed under WTFPL.
  3. Robert Zenz, several fixes and changes, re-licensed under CC-BY 4.0.

The set of changes include redone skinning, removal of duplicate surfaces and changes to the animations (mostly easing).

Configuration

The system can be configured by adding settings to the minetest.conf:

# If the system should be activated, defaults to true.
playermodel_activate = true

# The name of the model to use, defaults to "character.x".
playermodel_model_model = character.x

# The name of the texture to use.
playermodel_model_texture = character.png

# The size of the model in two values, x and y, defaults to "1, 1".
playermodel_model_size = 1, 1

# The base speed of the animations, defaults to 30.
playermodel_frame_speed = 30

# The base speed of the animations when the player is sneaking, defaults
# to 15.
playermodel_frame_speed_sneaking = 15

# The interval in which the animation is updated, in seconds, defaults
# to 0.066 seconds.
playermodel_interval = 0.066

# The parameters that follow are the start and end frame (both inclusive)
# of the animation, and optionally the frame speed for normal and sneaking.
# Like this: playermodel_animation_laying = 5, 89, 30, 15

playermodel_animation_digging = 189, 199
playermodel_animation_laying = 162, 167
playermodel_animation_sitting = 81, 161
playermodel_animation_standing = 0, 80
playermodel_animation_walking = 168, 188
playermodel_animation_walking_digging = 200, 220

Animation providers

You can register providers that provide an animation and a frame speed instead of the default implementation. It is a simple callback that accepts the Player object and returns the animation and the frame speed. It can return nil to not change the animation.

function(
    player)     -- The Player object for which to get the animation.

returns:
    animation,  -- The animation, a simple table containing x and y values
                -- which determine the start and end frame of the animation.
                -- Can be nil to not change it.
    frame_speed -- The frame speed of the animation. Can be nil to not
                -- change it.

Usage example: Simple

The most simple usecase is to simply use the mod without any modifications.

Usage example: Animation providers

One can register a provider for animation, like this:

-- Create the animation only once, to make sure that the playermodel cache
-- can work correctly. Consisting of the start and end frame, inclusive.
local drowning_animation = {
    x = 266,
    y = 328
}

-- Now we register the callback.
playermodel.register_animation_provider(function(player)
    if player:get_breath() <= 0 then
        -- Return the animation and a frame speed of 30,
        -- so that sneak does not change the frame speed.
        return drowning_animation, 30
    end
end)

Usage example: Custom usage

There is also the possibility to only use the player-model mod as utility mod, without any default functionality. Deactivate the default activation by placing this in the configuration:

playermodel_activate = false

After this, you can use the following functions directly without the system intervening with your affords:

playermodel.set_player_model(player, model, texture, size)
playermodel.set_player_animation(player, animation, frame_speed)

There is still the cache active to make sure that animations are not needlessly set on the player object. Here is a complete example:

minetest.register_on_joinplayer(function(player)
    playermodel.set_player_model(player, your_model, your_texture, your_size)
end)

minetest.register_on_globalstep(function(time)
    for index, player in ipairs(minetest.get_connected_players()) do
        playermodel.set_player_animation(your_animation)
    end
end)

Force activation

You can force the activation of the system, even if it has been disabled in in the configuration, by invoking playermodel.activate_internal.

Notes for changing the model

If you want to export a x (DirectX) file from Blender, you'll need to set the following options in the lower left panel:

  • Export Selected Objects Only
  • Export Meshes
  • Export Normals
  • Flip Normals
  • Export UV Coordinates
  • Export Materials
  • Export Vertex Colors
  • Export Skin Weights
  • Apply Modifiers
  • Export Amature Bones
  • Export Rest Position
  • Export Animations
  • Include Frame Rate
  • Export Actions as AnimationSets
  • Attach Unused Actions to First Amature
  • Verbose

There is a Solidify modifier set on the head, this is needed so that the hair or hat or cap is also visible from "the inside".