yorke Posted April 13, 2017 Share Posted April 13, 2017 Hi all, sorry if this may seem to be a stupid question but i'm struggling about that... I'm trying to raise only y coordinates of the vertices of a mesh face when I click on it. I retrieve the face id: faceID = window.engine.scenes[0].pick(offsetX, offsetY).faceId; Then I get indices: var indices_array = mesh.getIndices(); I get vertices positions array: var arr = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); But something goes wrong when I try to increment y coordinates of the three vertices: arr[indices_array[faceID*3]+1]+=1; arr[indices_array[faceID*3+1]+1]+=1; arr[indices_array[faceID*3+2]+1]+=1; mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, arr,true,true); It seems that with those formulas i'm picking the wrong vertices from face ids... What's wrong there? Tnx, cheers Quote Link to comment Share on other sites More sharing options...
yorke Posted April 13, 2017 Author Share Posted April 13, 2017 Sorry I managed by myself, I was not multiplying by 3 in the positions array, so I was accessing wrong array cells arr[indices_array[faceID*3]*3+1]+=1; arr[indices_array[faceID*3+1]*3+1]+=1; arr[indices_array[faceID*3+2]*3+1]+=1; Tnx Raggar 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 13, 2017 Share Posted April 13, 2017 Sounds good Quote 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.