Jump to content

Picking updated mesh


Dejan
 Share

Recommended Posts

Hi guys,

I have a problem with mesh picking and it is a specific case.

When I create a ribbon like this, I can see it on the scene:

 var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE);
            

On mouse down I am writing the name of the picked mesh in the log:

handleMouseDown: function(event){

var pickResult = _scene.pick(_scene.pointerX, _scene.pointerY);
var pickedPoint = pickResult.pickedPoint;
console.log(pickResult.pickedMesh.name); // writes ribb when I click on it
}

BUT, when I update the ribbon mesh after creation, like this:

  var someRibbon = BABYLON.Mesh.CreateRibbon("ribb", [[new BABYLON.Vector3(0, 0, 0), new BABYLON.Vector3(10, 0, 0)], [new BABYLON.Vector3(0, 10, 0), new BABYLON.Vector3(10, 10, 0)]], false, false, 0, _scene, true, BABYLON.Mesh.FRONTSIDE);
  someRibbon = BABYLON.Mesh.CreateRibbon(null, [[new BABYLON.Vector3(0, 0, 5), new BABYLON.Vector3(10, 0, 5)], [new BABYLON.Vector3(0, 10, 5), new BABYLON.Vector3(10, 10, 5)]], null, null, null, null, null, null, someRibbon);

Then I can see that the ribbon that is updated (moved 5units along z axis), but it can't be picked. Actually, the picker "thinks" that the ribbon is still in the old position.

Does someone have any idea how this could be solved?

Edited by Dejan
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...