Thread: Model tilting
View Single Post
10-23-13, 11:56 AM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Yep i was aware pretty much any api that models have, the bad part most of them is undocumented, i would like to add some descripion for some of the function i recently tried:

Model:ClearModel() -- Works fine unless your model is set by unit ids like: Model:SetModel("player"), you can clear that with Model:SetModel("none").

Model:SetCustomCamera() -- You can enabled this with 1 parameter, not sure how to disable it, my guess would be 0.

Model:GetCameraPosition() -- Gives you the current camera's X, Y, Z axis coordinates based on 0, 0, 0 point in this order: Y, X, Z.

Model:GetCameraDistance() -- Disabled, addons cant call it (Always returns 0.). Workaround to get the same value:

Lua Code:
  1. -- Set the model first.
  2. Model:SetModel(randommodel)
  3. -- Note here x is actually the y coordinate and y is x.
  4. local x, y, z = Model:GetCameraPosition()
  5. local r = math.sqrt((x * x) + (y * y) + (z * z))

Model:SetCameraDistance() -- Works fine.

Model:SetCameraPosition(x, y, z) -- Only works with "Model:SetCustomCamera(1)", the order is Y, X, Z.

I'm actually not sure whats the difference between Model and PlayerModel, i was always using PlayerModel.

Also you're right about the "SetRotation will fix it" but when you want to handle the tilting value with an onupdate script which automatically tilts the models in like 3-4 sec in 0-90 degrees then the random flipping could be annoying.

Last edited by Resike : 11-07-13 at 11:22 PM.
  Reply With Quote