VeTaL Posted October 29, 2010 Share Posted October 29, 2010 I didnt find info on the wiki: http://leadwerks.com/wiki/index.php?title=GetVertexPosition&redirect=no But at least i get syntax info: http://www.leadwerks.com/wiki/index.php?title=Surfaces#GetVertexPosition Also i found my old post, where i asking about this first time: http://leadwerks.com/werkspace/index.php?/topic/1640-access-to-vertex-position/page__p__15160__hl__vec_for_vertex__fromsearch__1#entry15160 In 3DGameStudio i can open model in Model EDitor, then select needed vertex (for example, point in hand, where i want to place weapon, or point on the weapon, where i want to place bullet) and then get position in 3d space. In Leadwerks i saw only FindChild(m_currentAnimationEntity, "FIRESPOT") but how can i get the position of firespot without bone, just with vertex coordinates? In the other worlds, how can i get the number of needed vertex in model? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted October 30, 2010 Author Share Posted October 30, 2010 I mean, on this picture it is shown how to get position with bones... How can i get position without bones, just with vertices? http://leadwerks.com/werkspace/index.php?/topic/314-wip-lua-weaponwerks-now-with-video/page__view__findpost__p__2802 Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted October 30, 2010 Share Posted October 30, 2010 Having a bone for the firespot obviously would be the easiest solution, but you could always just create the emitter in front of the gun using the TForm commands or even just create a Pivot that is parented to the front of the gun at the right spot. Using a vertex position for this can be done, but seems like an overkill for what you are trying to accomplish. 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...
VeTaL Posted October 30, 2010 Author Share Posted October 30, 2010 But the center of the gun is not affected by animation, so i would have static spot. I just want to get the coordinates of the bullet-firing point using not bones, but vertexes. But i have no idea how to find number of needed vertex (maybe i need to make little standalone application, where i wound run through all vertexes, highlight current one and cout current number) Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted October 31, 2010 Share Posted October 31, 2010 but thats just it... even with animation you will only be firing the gun when its aiming which also means for all intents and purposes the gun barrel is in one spot consistently... but in any case, finding the vertex is not that hard... there are several useful commands in the wiki that let you pull information about a mesh's vertex... require("Scripts/constants/keycodes") RegisterAbstractPath("") Graphics(800, 600) fw=CreateFramework() fw.main.camera:SetPosition(Vec3(1, 2, 1)) dlight= CreateDirectionalLight() dlight:SetRotation(Vec3(45, 60, 30)) mesh = LoadMesh("abstract::oildrum.gmf") surface = GetSurface(mesh,1) vertcount = CountVertices(surface) vertnumber=0 marker = CreateCube() marker:SetScale(Vec3(.02,.02,.02)) marker:SetColor(Vec4(1,0,0,1)) fw.main.camera:Point(mesh,3,1,0) fw.renderer:SetWireFrame(1) while KeyHit(KEY_ESCAPE)==0 do if KeyHit(KEY_UP)==1 and vertnumber <= vertcount-1 then vertnumber = vertnumber + 1 end if KeyHit(KEY_DOWN)==1 and vertnumber >= 1 then vertnumber = vertnumber - 1 end vertpos = GetVertexPosition(surface,vertnumber) marker:SetPosition(vertpos) campos=CameraUnproject(fw.main.camera,vertpos) fw:Update() fw:Render() SetBlend(1) DrawText(vertnumber,campos.x,campos.y) DrawText("Press UP/DOWN to increase/decrease vertex number",0,20) DrawText("Number of Vertices: "..vertcount,0,40) DrawText("Current Vertex Number: "..vertnumber,0,60) DrawText("Current Vertex Position: "..vertpos.x..","..vertpos.y..","..vertpos.z,0,80) SetBlend(0) Flip() end 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...
VeTaL Posted October 31, 2010 Author Share Posted October 31, 2010 Oh thanks, thats it I think, i'll add here mouse clicks and selection of the nearest vertex and post on forum. But in general, i think its a good idea to have possibility to select vertexes in Model Viewer and get info about its number. Quote Working on LeaFAQ 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.