|
2013-03-25 00:58
조회: 1,490
추천: 0
플레이어의 시선에 따른 방향전환 도우미어쩌다보니 질문을 하게 되네요 [...
self.f = CreateFrame("Button", nil, UIParent) self.f:SetPoint("CENTER") self.f:SetFrameLevel(20) self.f:EnableMouse(false) self.f:SetWidth(32) self.f:SetHeight(32) self.f:Hide() self.f.elapsed = 0 self.f:SetScript("OnUpdate", OnUpdate) self.t = self.f:CreateTexture("OVERLAY") self.f.texture = t self.t:SetTexture([[Interface\Minimap\MinimapArrow]]) local function GetBearing (unit) tx, ty = GetPlayerMapPosition (unit) if tx == 0 and ty == 0 then return 999 end px, py = GetPlayerMapPosition ("player") return -GetPlayerFacing () - atan2 (tx - px, py - ty) end local s2 = sqrt(2) local function CalculateCorner (r) return 0.5 + cos(r) / s2, 0.5 + sin(r) / s2; end local function RotateTexture (texture, angle) local LRx, LRy = CalculateCorner (angle + 0.785398163); local LLx, LLy = CalculateCorner (angle + 2.35619449); local ULx, ULy = CalculateCorner (angle + 3.92699082); local URx, URy = CalculateCorner (angle - 0.785398163); texture:SetTexCoord (ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); end RotateTexture (self.t, bearing) 를 이용해서 '대상의 위치를' '플레이어의 시선 기준으로' 화살표 텍스쳐를 이용하여 화면에 표시하는 내용입니다. ![]() └ 작동 모습 분명 위 매크로는 작동이 잘 되는데 이를 응용해서 '특정 방향'을 '플레이어의 시선 기준으로' 봤을때 가리키는 방향을 화살표 텍스쳐로 만들려고 하는데.. 오히려 이게 더 쉽지가 않네요. 특정 방향이라는게 맵을 기준으로 항상 북쪽을 가리킨다고 하면... 플레이어의 y좌표+100 을 한 값과 비교를 하면 된다고 생각했는데 그건 또 아니더라구요. 매크로 보다는 논리적인 문제가 생기는데 혹여나 관심있는 분들은 도움을 부탁드립니다. |

달이뜨는밤 