Player API: Set eye height property for new player model
authorparamat <paramat@users.noreply.github.com>
Sun, 5 Nov 2017 04:28:52 +0000 (04:28 +0000)
committerparamat <mat.gregory@virginmedia.com>
Mon, 6 Nov 2017 15:40:14 +0000 (15:40 +0000)
Correct the collisionbox height.

game_api.txt
mods/player_api/api.lua
mods/player_api/init.lua

index 379e3f853cab624097943ace1638a5e5cced6f3b..82711288b56ec5ca9cb557f584151b6422a62ac4 100644 (file)
@@ -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
        }
 
 
index c79aedc3f2dfb1d8f99c2ad053df874373109f9c..e309b08d6b07915d5c781c1176cc574ecc53d2e2 100644 (file)
@@ -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
@@ -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
index 86ea340d7fdb05e46ff513faa0db137d4b41a73a..7a1f353ea231cd3a9cf47949e8d1b6dd1df94d0b 100644 (file)
@@ -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