mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-30 12:43:49 +01:00
Properly read the mesh from LUA.
Players can now be set to meshes using the following test script:
function switch_player_visual()
prop = {
mesh="player.obj",
texture="player.png",
visual="mesh",
}
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)
This commit is contained in:
committed by
Perttu Ahola
parent
ac97a7f70e
commit
0a020dbcc8
@@ -802,14 +802,18 @@ public:
|
||||
else if(m_prop.visual == "mesh"){
|
||||
infostream<<"GenericCAO::addToScene(): mesh"<<std::endl;
|
||||
scene::IAnimatedMesh *mesh = smgr->getMesh(m_prop.mesh.c_str());
|
||||
m_animated_meshnode = smgr->addAnimatedMeshSceneNode(mesh, NULL);
|
||||
mesh->drop();
|
||||
|
||||
m_animated_meshnode->setScale(v3f(m_prop.visual_size.X,
|
||||
m_prop.visual_size.Y,
|
||||
m_prop.visual_size.X));
|
||||
u8 li = m_last_light;
|
||||
setMeshColor(m_animated_meshnode->getMesh(), video::SColor(255,li,li,li));
|
||||
if(mesh)
|
||||
{
|
||||
m_animated_meshnode = smgr->addAnimatedMeshSceneNode(mesh, NULL);
|
||||
|
||||
m_animated_meshnode->setScale(v3f(m_prop.visual_size.X,
|
||||
m_prop.visual_size.Y,
|
||||
m_prop.visual_size.X));
|
||||
u8 li = m_last_light;
|
||||
setMeshColor(m_animated_meshnode->getMesh(), video::SColor(255,li,li,li));
|
||||
}
|
||||
else
|
||||
errorstream<<"GenericCAO::addToScene(): Could not load mesh "<<m_prop.mesh<<std::endl;
|
||||
}
|
||||
else if(m_prop.visual == "wielditem"){
|
||||
infostream<<"GenericCAO::addToScene(): node"<<std::endl;
|
||||
|
||||
Reference in New Issue
Block a user