Jump to content

Change vertices positions


Recommended Posts

I the example below i am trying to morph a skinned character head by modifying its vertices positions.
Weird is that this breaks the mesh, even when i apply its original positions.

Is that maybe because the mesh is skinned? Or am i missing something?

// get the original positions of vertices
var vertexData = BABYLON.VertexData.ExtractFromMesh(this.head);
var verticesArray = [];
var vertices = vertexData.positions;

for (var i = 0; i < vertices.length; i+=3) {
    verticesArray.push(BABYLON.Vector3.FromArray(vertices, i));

// now... after i modified the positions (in another function) push them to array
var positions = [];
for (var i = 0; i < vertices.length; i++) {
  var v = vertices;

// and apply to the mesh
this.head.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions, true);


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.

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.


  • Recently Browsing   0 members

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