Add script to turn players into meshes, ticks every 1 second

Trigger the player.lua file in init.lua

Commit the ugly and temporary test model and texture. We'll get to a real animated player mesh once the code for that is ready

Set visual_size accordingly so the player model doesn't stretch vertically (default of the sprite player)

Attempt to use the b3d model format, although it doesn't seem to work so far
This commit is contained in:
MirceaKitsune 2012-10-24 15:23:45 +03:00 committed by Perttu Ahola
parent dfa0f096ce
commit 0057a87b99
6 changed files with 147 additions and 0 deletions

View File

@ -12,6 +12,7 @@ LIGHT_MAX = 14
default = {}
-- Load other files
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/leafdecay.lua")

Binary file not shown.

View File

@ -0,0 +1,12 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2

View File

@ -0,0 +1,106 @@
# Blender v2.64 (sub 0) OBJ File: ''
# www.blender.org
mtllib player.mtl
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
v 1.194667 -1.194667 0.000000
v 0.000000 -1.194667 -1.194667
v 1.194667 0.000000 -1.194666
v 0.000000 -1.194667 1.194667
v 1.194666 0.000000 1.194667
v -1.194667 -1.194667 -0.000000
v -1.194667 0.000000 1.194666
v -1.194666 0.000000 -1.194667
v 1.194667 1.194667 0.000001
v 0.000000 1.194667 -1.194667
v -0.000001 1.194667 1.194667
v -1.194667 1.194667 -0.000000
v 0.000000 -1.543509 -0.000000
v -0.000000 1.543509 0.000000
v 1.543509 0.000000 0.000000
v -0.000000 0.000000 1.543509
v -1.543509 0.000000 -0.000000
v 0.000000 0.000000 -1.543509
v -1.500000 -1.500000 1.500000
v 1.500001 1.500000 -1.499999
v 1.792000 0.000000 -1.792000
v -0.000000 -1.792000 1.792000
v -1.792001 -0.000000 1.792000
v 0.000000 1.792000 -1.792000
v -0.000001 -0.000000 2.315264
v 0.000001 0.000000 -2.315264
vt 0.750000 0.750000
vt 0.790763 0.846234
vt 0.699682 0.874273
vt 0.653766 0.790763
vt 0.250000 0.250000
vt 0.153766 0.290763
vt 0.125727 0.199681
vt 0.209237 0.153766
vt 0.500000 0.144103
vt 0.346234 0.209237
vt 0.300318 0.125727
vt 0.351225 0.000000
vt 0.144103 0.000000
vt 0.000000 0.148774
vt 0.000000 0.355896
vt 0.199681 0.374273
vt 0.148774 0.500000
vt 0.644104 0.500000
vt 0.709237 0.653766
vt 0.625727 0.699681
vt 0.500000 0.648774
vt 0.800319 0.625727
vt 0.846234 0.709237
vt 0.874273 0.800318
vt 0.374273 0.300318
vt 0.290763 0.346234
vt 1.000000 0.644103
vt 1.000000 0.851226
vt 0.851226 0.500000
vt 0.500000 0.351226
vt 0.855897 1.000000
vt 0.500000 0.855896
vt 0.648774 1.000000
vt 0.355896 0.500000
usemtl Material
s off
f 21/1 12/2 3/3 14/4
f 22/5 20/6 7/7 19/8
f 23/9 17/10 6/11 13/12
f 24/13 19/8 7/7 15/14
f 25/15 20/6 8/16 16/17
f 26/18 10/19 4/20 16/21
f 10/19 21/1 14/4 4/20
f 1/22 9/23 21/1 10/19
f 9/23 2/24 12/2 21/1
f 17/10 22/5 19/8 6/11
f 5/25 18/26 22/5 17/10
f 18/26 8/16 20/6 22/5
f 9/23 23/27 13/28 2/24
f 1/22 11/29 23/27 9/23
f 11/30 5/25 17/10 23/9
f 33/31 30/2 12/2 24/31
f 2/24 13/28 24/31 12/2
f 13/12 6/11 19/8 24/13
f 14/4 25/32 16/21 4/20
f 3/3 15/33 25/32 14/4
f 15/14 7/7 20/6 25/15
f 18/26 26/34 16/17 8/16
f 18/26 5/25 28/25 32/26
f 11/29 1/22 10/19 26/18
f 30/2 33/31 31/33 27/3
f 28/25 29/30 34/34 32/26
f 30/2 27/3 3/3 12/2
f 24/13 15/14 31/14 33/13
f 29/30 28/25 5/25 11/30
f 26/34 18/26 32/26 34/34
f 15/33 3/3 27/3 31/33
f 34/18 29/29 11/29 26/18

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

28
mods/default/player.lua Normal file
View File

@ -0,0 +1,28 @@
-- Minetest 0.4 mod: player
-- See README.txt for licensing and other information.
-- The API documentation in here was moved into doc/lua_api.txt
-- Set mesh for all players
function switch_player_visual()
prop = {
mesh="player.b3d",
textures = {"player.png", },
visual="mesh",
visual_size={x=1, y=1},
}
for _, obj in pairs(minetest.get_connected_players()) do
obj:set_properties(prop)
end
minetest.after(1.0, switch_player_visual)
end
minetest.after(1.0, switch_player_visual)
-- Definitions made by this mod that other mods can use too
default = {}
-- Load other files
dofile(minetest.get_modpath("default").."/mapgen.lua")
dofile(minetest.get_modpath("default").."/leafdecay.lua")
-- END