Thread Tools Display Modes
01-05-18, 04:15 PM   #1
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Horizontally flipping PlayerModel object

Hi fellow forum members!

I guess title says pretty much all.
Currently trying to flip a PlayerModel object horizontally, but nothing worked out for me. Unlike 3D model, 2D portraits were super easy to flip as you just need to call :SetTexCoord(1, 0, 0, 1). However, 3D model doesn't seem to work this way as frame widgets don't have SetTexCoord function
(SetRotation didn't do a trick as well...)

Any ideas, please?

Last edited by Eungavi : 01-05-18 at 04:18 PM.
  Reply With Quote
01-05-18, 04:22 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
:SetFacing(radians)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-05-18, 04:38 PM   #3
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Facepalm...

Was only looking at PlayerModel APIs, not the entire Model APIs

Thank you Seerah!! I'll have a go with it
  Reply With Quote
01-05-18, 04:51 PM   #4
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Okay,

the following code:

Lua Code:
  1. local p1 = CreateFrame("PlayerModel", "p1", UIParent)
  2. p1:SetSize(128, 128)
  3. p1:SetPoint("RIGHT", UIParent, "CENTER", -64, 0)
  4. p1:SetCamDistanceScale(1)
  5. p1:SetPortraitZoom(1)
  6. p1:SetPosition(0, 0, 0)
  7. p1:ClearModel()
  8. p1:SetUnit("player")
  9.  
  10. local p2 = CreateFrame("PlayerModel", "p2", UIParent)
  11. p2:SetSize(128, 128)
  12. p2:SetPoint("LEFT", UIParent, "CENTER", 64, 0)
  13. p2:SetCamDistanceScale(1)
  14. p2:SetPortraitZoom(1)
  15. p2:SetPosition(0, 0, 0)
  16. p2:ClearModel()
  17. p2:SetUnit("player")
  18. p2:SetFacing(-(math.pi / 2))

give this result



ans seems it is complex than I thought. Guess I'll have to calculate set some values with camera as well
I actually expected something that would mirror the 3D model like the 2D model with SetTexCoord did tho...

Last edited by Eungavi : 01-05-18 at 04:54 PM.
  Reply With Quote
01-05-18, 05:45 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
It doesn't mirror it, it rotates it on the vertical axis. If the character model isn't exactly centered on the axis, it'll look off like that.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-05-18, 06:20 PM   #6
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by Seerah View Post
It doesn't mirror it, it rotates it on the vertical axis. If the character model isn't exactly centered on the axis, it'll look off like that.
So, is centering a 3D model on y-axis possible with provided model APIs?!
  Reply With Quote
01-05-18, 07:50 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
With
Code:
Model:SetPosition(Zoomin/MoveRight or Zoomout/MoveLeft, MoveLeft or MoveRight, MoveUp or MoveDown)
Model:SetFacing(Rotate Left or right)
Model:SetPortraitZoom(Zoomin and Rotate Left or Zoomout and Rotate Right) Differnt action occure once eith the full body is in frame of you've zoomed into the face as far is it can
You can do pretty much anything.

Default with PortraitZoom set to 1:


Lua Code:
  1. SetPosition(-0.2, 0.4, 0) --zoom out and left -0.2, move right 0.4, Up/Down 0
  2. SetFacing(-0.9) -- rotate left -0.9
  3. SetPortraitZoom(1) -- no change
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-05-18, 09:18 PM   #8
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
So, there is no staright-forward way to directly mirror the portrait hm... T_T


Thank you Fizzlemizz!
  Reply With Quote
01-05-18, 10:37 PM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
You can with a 2D portrait using SetTexCoord but not with 3D. Many models are slightly differently located in the frame and different animations especially when zoomed in require different placement even between sexes not to mention races when you start playing with positioning.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Horizontally flipping PlayerModel object


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off