Skip to content

Commit d4e1bd0

Browse files
committedNov 6, 2017
Player API: Set eye height property for new player model
Correct the collisionbox height.
1 parent 9d9e9b6 commit d4e1bd0

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
 

Diff for: ‎game_api.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,9 @@ The player API can register player models and update the player's appearence
364364
bar = {x = 20, y = 39},
365365
-- ...
366366
},
367-
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3}, -- In nodes from feet position
367+
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, -- In nodes from feet position
368368
stepheight = 0.6, -- In nodes
369+
eye_height = 1.47, -- In nodes above feet position
369370
}
370371

371372

Diff for: ‎mods/player_api/api.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ function player_api.set_model(player, model_name)
4545
textures = player_textures[name] or model.textures,
4646
visual = "mesh",
4747
visual_size = model.visual_size or {x = 1, y = 1},
48-
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
48+
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
4949
stepheight = model.stepheight or 0.6,
50+
eye_height = model.eye_height or 1.47,
5051
})
5152
player_api.set_animation(player, "stand")
5253
else
@@ -55,6 +56,7 @@ function player_api.set_model(player, model_name)
5556
visual = "upright_sprite",
5657
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
5758
stepheight = 0.6,
59+
eye_height = 1.625,
5860
})
5961
end
6062
player_model[name] = model_name

Diff for: ‎mods/player_api/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ player_api.register_model("character.b3d", {
1515
},
1616
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
1717
stepheight = 0.6,
18+
eye_height = 1.47,
1819
})
1920

2021
-- Update appearance when the player joins

0 commit comments

Comments
 (0)
Please sign in to comment.