Thread: Model tilting
View Single Post
10-27-13, 08:18 AM   #32
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Yeah, cos(pi / 2) is 0 so any changes don't show while at that point. I have a similar change in the code I'm playing with. Basically the same thing:
Code:
local PITCH_LIMIT = PI / 2 - 0.05

local function OnUpdate(self, elapsed)
    local x, y = GetCursorPosition()
    local yaw = self.yaw + (x - self.x) * INCREMENT_RATIO
    local pitch = self.pitch + (y - self.y) * INCREMENT_RATIO
    if pitch > PITCH_LIMIT then
        pitch = PITCH_LIMIT
    elseif pitch < -PITCH_LIMIT then
        pitch = -PITCH_LIMIT
    end
    self:SetOrientation(self.distance, yaw, pitch)
    self.x, self.y = x, y
end
Edit: Updated initial code to reflect the changes so far.

Last edited by Vrul : 10-27-13 at 10:06 AM.
  Reply With Quote