From c729543ec4ab5cba167b97f0b8c796de3de88a26 Mon Sep 17 00:00:00 2001 From: shivajiva101 Date: Sat, 29 Apr 2017 17:18:46 +0100 Subject: [PATCH] Fix visual slide issue with set_detach, fixes #5620 --- src/script/lua_api/l_object.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 9668f76f7..a5b6e3941 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -726,11 +726,13 @@ int ObjectRef::l_set_detach(lua_State *L) v3f rotation; co->getAttachment(&parent_id, &bone, &position, &rotation); ServerActiveObject *parent = NULL; - if (parent_id) + if (parent_id) { parent = env->getActiveObject(parent_id); - + co->setAttachment(0, "", position, rotation); + } else { + co->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); + } // Do it - co->setAttachment(0, "", v3f(0,0,0), v3f(0,0,0)); if (parent != NULL) parent->removeAttachmentChild(co->getId()); return 0; -- 2.25.1