Model:SetPosition
Jump to navigation
Jump to search
Positions a model relative to the bottom-left corner.
Model:SetPosition(positionX, positionY, positionZ)
Arguments
- positionX
- number - Positive values moves the model right; negative left.
- positionY
- number - Positive values moves the model up, negative down.
- positionZ
- number - Positive values moves the model nearer; negative further away.
Details
- 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, and the screen resolution returned by GetScreenWidth/GetScreenHeight.
Example
The following script calculates these top and right edges:
local scale = UIParent:GetEffectiveScale();
local hypotenuse = ( ( GetScreenWidth() * scale ) ^ 2 + ( GetScreenHeight() * scale ) ^ 2 ) ^ 0.5;
local coordRight = ( model:GetRight() - model:GetLeft() ) / hypotenuse; -- X
local coordTop = ( model:GetTop() - model:GetBottom() ) / hypotenuse; -- Y