Widget API ← Model < SetPosition

Syntax Edit

SetPosition( x, y, z );

Parameters Edit

Arguments Edit

float - sets the x-value of the model position
float - sets the y-value of the model position
float - sets the z-value of the model position

positive values of x will move the model right, negative will move it left
positive values of y will move the model up, negative will move it down
positive values of z will bring the model nearer to you, negative will bring it away

Returns Edit



The bottom left corner of the Model frame will always have coordinates (0,0,0). However, the top right corner's coordinate depends upon the width and height of the Model frame, as well as the screen resolution returned by GetScreenWidth/GetScreenHeight. The following formula determines the Model-relative coordinate that corresponds to the top-right of the Model frame (CoordRight,CoordTop,0):

local Scale = UIParent:GetEffectiveScale();
local Hypotenuse = ( ( GetScreenWidth() * Scale ) ^ 2 + ( GetScreenHeight() * Scale ) ^ 2 ) ^ 0.5;

local CoordRight = ( MyModelFrame:GetRight() - MyModelFrame:GetLeft() ) / Hypotenuse; -- X
local CoordTop = ( MyModelFrame:GetTop() - MyModelFrame:GetBottom() ) / Hypotenuse; -- Y

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.