Jump to content

[Solved] Problems getting vertex indexes from face id


yorke
 Share

Recommended Posts

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

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...