From bb80e6b375e0b757b0866d170c6b2e26c21e25b2 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sat, 29 Oct 2011 16:16:59 +0300 Subject: [PATCH] Detach objects at exactly the same origin, not the origin of the parent. Angles however are reset to the parent's, so that detached objects don't spin or roll --- qcsrc/server/mutators/sandbox.qc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 7de8f4cb0..8f595c059 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -85,16 +85,18 @@ void sandbox_ObjectAttach_Remove(entity e) { if(head.owner == e) { + vector org; head.movetype = MOVETYPE_TOSS; // default head.solid = SOLID_BBOX; head.takedamage = DAMAGE_AIM; + org = gettaginfo(head, 0); setattachment(head, world, ""); head.owner = world; - // objects reset origin and angles when detached, so apply the parent's to prevent teleporting - setorigin(head, e.origin); - head.angles = e.angles; + // objects change origin and angles when detached, so apply previous position + setorigin(head, org); + head.angles = e.angles; // don't allow detached objects to spin or roll } } } -- 2.39.2