Originally Posted by Resike
Quick question what does the SetOrientation do?
|
It sets the camera position based on the distance from the model, the yaw (rotation about the z-axis), and pitch (rotation about the y-axis). Since you need to know all 3 of those parameters to properly set the camera I figured one function call is better than three that would end up reproducing most of the work of each other.
Originally Posted by Resike
any chance to save the positions on mouseup and continue from there in the next click?
|
Sure, just change the OnUpdate function to this:
Code:
local function OnUpdate(self)
local x, y = GetCursorPosition()
local yaw = self.yaw + (x - self.x) * INCREMENT_RATIO
local pitch = self.pitch + (y - self.y) * INCREMENT_RATIO
if pitch > HALF_PI then
pitch = HALF_PI
elseif pitch < -HALF_PI then
pitch = -HALF_PI
end
self:SetOrientation(self.distance, yaw, pitch)
self.x, self.y = x, y
end
Originally Posted by Resike
Also you could add the model:SetPosition(x, y, z) function to right clicking, then you have pretty much all the model functions in it.
|
Maybe later. I only played around with this to get a break from my current project which I need to get back to.