View Single Post
08-07-14, 10:22 AM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Just a head up, in Power Auras i updated the Reset() method like this:

Lua Code:
  1. function model:GetBaseCameraTarget()
  2.     local modelfile = self:GetModel()
  3.     if modelfile and modelfile ~= "" then
  4.         local tempmodel = CreateFrame("PlayerModel", nil, UIParent)
  5.         tempmodel:SetModel(modelfile)
  6.         tempmodel:SetCustomCamera(1)
  7.         local x, y, z = tempmodel:GetCameraTarget()
  8.         tempmodel:ClearModel()
  9.         return x, y, z
  10.     end
  11. end
  12.  
  13. function model:Reset()
  14.     local modelfile = self:GetModel()
  15.     self:ClearModel()
  16.     self:SetModel(modelfile)
  17.     -- With model id
  18.     --self:SetDisplayInfo(modelid)
  19.     self:SetRotation(0)
  20.     self:SetPosition(0, 0, 0)
  21.     self:RefreshCamera()
  22.     self:SetCustomCamera(1)
  23.     if self:HasCustomCamera() then
  24.         local x, y, z = self:GetCameraPosition()
  25.         local tx, ty, tz = self:GetCameraTarget()
  26.         self:SetCameraTarget(0, ty, tz)
  27.         self:SetOrientation(math.sqrt(x * x + y * y + z * z), - math.atan(y / x), - math.atan(z / x))
  28.     end
  29.     --[[self:SetCustomCamera(1)
  30.     self:SetCameraPosition(x, y, z)
  31.     self:SetPosition(px, py, pz)
  32.     self:SetRotation(rot)
  33.     self:SetCameraTarget(0, ty, tz)
  34.     self:SetOrientation(math.sqrt(x * x + y * y + z * z), - math.atan(y / x), - math.atan(z / x))]]
  35. end

This solution was just a temporary hack:

Lua Code:
  1. self:SetCameraTarget(0, 0, pi / 5)

Last edited by Resike : 08-07-14 at 10:26 AM.