Page 1 of 1

Attach an object/node/model to a player

PostPosted: Sun Dec 25, 2016 16:45
by Nekrofage
Hi !! :D

I search an example of Lua code to attach an object/node/model to a player.
Do you have links or codes about that ?

Thank in advance!

Re: Attach an object/node/model to a player

PostPosted: Mon Dec 26, 2016 13:15
by stu
My wield3d mod has an example of how to do this, if you will excuse the blatant self-promotion. Be warned, however, that object attachment in minetest is rather buggy.

Re: Attach an object/node/model to a player

PostPosted: Tue Dec 27, 2016 21:38
by AiTechEye
here are another example:

-- attach object
obj_to_attach:set_attach(on_obj, "", {x=0,y=0,z=0}, {x=0,y=0,z=0})

-- check if attached and detach it
if obj:get_attach() then
obj:set_detach()
end

Re: Attach an object/node/model to a player

PostPosted: Fri Feb 03, 2017 21:34
by Nekrofage
Hi all !! :D

Thank you for your Lua code examples !