I managed to tilt ingame models in the x axis like this:
However my code only works with ~45 degree tilt yet.
Lua Code:
local frame = CreateFrame("Frame", nil, UIParent)
frame:SetPoint("Center", 128, 0)
frame:SetWidth(512 / (2 * math.sqrt(2)))
frame:SetHeight(512 / (2 * math.sqrt(2)))
frame:SetAlpha(1)
local model = CreateFrame("PlayerModel", nil, frame)
model:SetAllPoints(frame)
local zz = 2
function ModelBasics_UpdateModel()
model:SetModel("Creature/LasherSunflower/lasher_sunflower.m2")
model:SetRotation(math.rad(0))
model:SetAlpha(1)
model:SetCustomCamera(1)
model:SetCameraDistance(1)
local x, y, z = model:GetCameraPosition()
model:SetCameraPosition(x, y, zz)
model:SetPosition(0, 0, - (zz * zz))
end
ModelBasics_UpdateModel()
local frame2 = CreateFrame("Frame", nil, UIParent)
frame2:SetPoint("Center", - 128, 0)
frame2:SetWidth(512)
frame2:SetHeight(512)
frame2:SetAlpha(1)
local model2 = CreateFrame("PlayerModel", nil, frame)
model2:SetAllPoints(frame2)
function ModelBasics_UpdateModel2()
model2:SetModel("Creature/LasherSunflower/lasher_sunflower.m2")
model2:SetRotation(math.rad(0))
model2:SetAlpha(1)
end
ModelBasics_UpdateModel2()
Also i'm unable to create a slider for this zz (aka the tilt value) to work properly with every value from 0-90 (0-180 would be the best) degrees. Maybe someone with more experience can help me with this?
I think this would be an awsome feature for addons.