Forums WoW Modding Discussion Interface [Archive] 3.3.5a (API 30300) - Display object on screen

[Archive] 3.3.5a (API 30300) - Display object on screen

[Archive] 3.3.5a (API 30300) - Display object on screen

rektbyfaith
Administrator
0
07-02-2019, 08:30 PM
#1
Archived author: FiftyTifty • Posted: 2019-07-02T20:30:57+00:00
Original source

For a renderer mod that's being developed, I need a way to tell which zone the player is in, and the only real way of doing that is to detect for a specific mesh being rendered on the screen. I've looked at other addons, and came up with the following:

local frame = CreateFrame("Frame", nil, UIParent)
frame:SetPoint("Center", 128, 0)
frame:SetWidth(256)
frame:SetHeight(256)
frame:SetAlpha(1)

local model = CreateFrame("PlayerModel", nil, frame)
model:SetAllPoints(frame)

function ModelBasics_UpdateModel()
model:SetModel("Interface\Buttons\talktome.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, 0)
model:SetPosition(0, 0, 0)
end

ModelBasics_UpdateModel()

Which displays the following model: [Image: yEB4gEz.jpg]

For some reason, I can't change it's position by editing "model:SetPosition(0, 0, 0)". It just stays in that exact same place. Is there anything I can do to change the object being rendered, and to rotate, and move it?
rektbyfaith
07-02-2019, 08:30 PM #1

Archived author: FiftyTifty • Posted: 2019-07-02T20:30:57+00:00
Original source

For a renderer mod that's being developed, I need a way to tell which zone the player is in, and the only real way of doing that is to detect for a specific mesh being rendered on the screen. I've looked at other addons, and came up with the following:

local frame = CreateFrame("Frame", nil, UIParent)
frame:SetPoint("Center", 128, 0)
frame:SetWidth(256)
frame:SetHeight(256)
frame:SetAlpha(1)

local model = CreateFrame("PlayerModel", nil, frame)
model:SetAllPoints(frame)

function ModelBasics_UpdateModel()
model:SetModel("Interface\Buttons\talktome.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, 0)
model:SetPosition(0, 0, 0)
end

ModelBasics_UpdateModel()

Which displays the following model: [Image: yEB4gEz.jpg]

For some reason, I can't change it's position by editing "model:SetPosition(0, 0, 0)". It just stays in that exact same place. Is there anything I can do to change the object being rendered, and to rotate, and move it?

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)