Fix visual slide issue with set_detach, fixes #5620

This commit is contained in:
shivajiva101 2017-04-29 17:18:46 +01:00 committed by sfan5
parent 3251e44938
commit c729543ec4
1 changed files with 5 additions and 3 deletions

View File

@ -726,11 +726,13 @@ int ObjectRef::l_set_detach(lua_State *L)
v3f rotation; v3f rotation;
co->getAttachment(&parent_id, &bone, &position, &rotation); co->getAttachment(&parent_id, &bone, &position, &rotation);
ServerActiveObject *parent = NULL; ServerActiveObject *parent = NULL;
if (parent_id) if (parent_id) {
parent = env->getActiveObject(parent_id); parent = env->getActiveObject(parent_id);
co->setAttachment(0, "", position, rotation);
// Do it } else {
co->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); co->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0));
}
// Do it
if (parent != NULL) if (parent != NULL)
parent->removeAttachmentChild(co->getId()); parent->removeAttachmentChild(co->getId());
return 0; return 0;