Jump to content

SetMousePosition not setting z value


RygtY
 Share

Recommended Posts

I'm not sure if this is a bug but the SetMousePosition function that takes in three parameters, the x value, y value, and z value, does not properly set the z value of the mouse position.

 

One can test this using this code snippet.

 

self.window = Window:GetCurrent()
self.window:SetMousePosition(50.0,50.0,10.0)
System:Print(self.window:GetMousePosition():ToString())

 

The z value still remains 0.0

Link to comment
Share on other sites

function App:Start()

self.window = Window:Create()

self.context = Context:Create(self.window)

self.world = World:Create()

self.camera = Camera:Create()

self.camera:Move(0,0,-3)

local light = DirectionalLight:Create()

light:SetRotation(35,35,0)

 

self.model = Model:Box()

self.model:SetColor(0.0,0.0,1.0)

 

self.prevZ = self.camera:GetPosition(true).z

self.posZ = 0

 

return true

end

 

function App:Loop()

if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end

 

self.model:Turn(0,Time:GetSpeed(),0)

 

local div = 5

self.posZ = Math:Curve(self.prevZ + (self.window:GetMousePosition().z/div), self.posZ, div/Time:GetSpeed())

self.camera:SetPosition(0,0, self.posZ)

 

Time:Update()

self.world:Update()

self.world:Render()

 

self.context:SetBlendMode(Blend.Alpha)

self.context:DrawText("Mouse Wheel Position: "..self.window:GetMousePosition().z, 2, 2)

self.context:DrawText(string.format("Camera Z Position: %.2f",self.posZ), 2, 22)

self.context:SetBlendMode(Blend.Solid)

 

self.context:Sync()

 

return true

end

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...