Skip to content

Commit

Permalink
Player API: Set eye height property for new player model
Browse files Browse the repository at this point in the history
Correct the collisionbox height.
  • Loading branch information
paramat committed Nov 6, 2017
1 parent 9d9e9b6 commit d4e1bd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion game_api.txt
Expand Up @@ -364,8 +364,9 @@ The player API can register player models and update the player's appearence
bar = {x = 20, y = 39},
-- ...
},
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3}, -- In nodes from feet position
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, -- In nodes from feet position
stepheight = 0.6, -- In nodes
eye_height = 1.47, -- In nodes above feet position
}


Expand Down
4 changes: 3 additions & 1 deletion mods/player_api/api.lua
Expand Up @@ -45,8 +45,9 @@ function player_api.set_model(player, model_name)
textures = player_textures[name] or model.textures,
visual = "mesh",
visual_size = model.visual_size or {x = 1, y = 1},
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
stepheight = model.stepheight or 0.6,
eye_height = model.eye_height or 1.47,
})
player_api.set_animation(player, "stand")
else
Expand All @@ -55,6 +56,7 @@ function player_api.set_model(player, model_name)
visual = "upright_sprite",
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
stepheight = 0.6,
eye_height = 1.625,
})
end
player_model[name] = model_name
Expand Down
1 change: 1 addition & 0 deletions mods/player_api/init.lua
Expand Up @@ -15,6 +15,7 @@ player_api.register_model("character.b3d", {
},
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
stepheight = 0.6,
eye_height = 1.47,
})

-- Update appearance when the player joins
Expand Down

0 comments on commit d4e1bd0

Please sign in to comment.