CrazyM Posted January 22, 2016 Share Posted January 22, 2016 I can't seem to find a conversion method in the API for object space to world space. [surface:GetVertexPosition()] appears to return local coordinates, and I need to convert the output to global coordinates. Thanks Quote CrazyMinnowStudio.com Youtube, Twitter, Facebook, G+ Link to comment Share on other sites More sharing options...
macklebee Posted January 22, 2016 Share Posted January 22, 2016 http://www.leadwerks.com/werkspace/page/api-reference/_/transform/transformpoint-r543 window = Window:Create() context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,2,6) light = DirectionalLight:Create() light:SetRotation(35,35,0) model = Model:Box() model:SetColor(0.0,0.0,1.0) model:SetPosition(0,2,9) model:SetRotation(45,45,0) surface = model:GetSurface(0) marker = Model:Box() marker:SetScale(.05,.05,.05) marker:SetColor(1,0,0,1) while window:KeyDown(Key.Escape)==false do if window:Closed() then break end model:Turn(0,-0.2,0.5) localpos = surface:GetVertexPosition(0) globalpos = Transform:Point(localpos,model,nil) screenpos = camera:Project(globalpos) marker:SetPosition(globalpos) Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("Local Vertex Position: "..localpos:ToString(),2,2) context:DrawText("Global Vertex Position: "..globalpos:ToString(),2,22) context:DrawText("Vert0",screenpos.x,screenpos.y) context:SetBlendMode(Blend.Solid) context:Sync(true) end 6 Quote 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 More sharing options...
CrazyM Posted January 22, 2016 Author Share Posted January 22, 2016 Hey macklebee, long time no see speak. Exactly what I was looking for, thank you! 1 Quote CrazyMinnowStudio.com Youtube, Twitter, Facebook, G+ Link to comment Share on other sites More sharing options...
Josh Posted January 22, 2016 Share Posted January 22, 2016 Damn, that is good support. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
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.