Jump to content

Casting Rays on transformed Objects


Recommended Posts

So when I bake out the my objects transforms in this scene:
and try to do my raycast protection, none of the rays hit... which I find odd.
here if I do not bake out the mesh that I am casting from some of the points hit, but they are not being cast from the correct positions, so I am confused.
its been a long day so maybe I am just missing something simple.

trying to make it so I can move my plane or mesh that I am projecting the UV to like i did here:

Here is what happens when I bake the transforms prior to my sectionMesh function.

I am wondering if its the sectionMesh function that is giving me trouble.

Nope its not:  https://www.babylonjs-playground.com/#NAG06Y#30
Something is not getting baked it seems.

Link to comment
Share on other sites

So I am thinking its not my ray casting that is messing this up, and is actually the sectionMesh method I am using.

Is there a way to split up a mesh out into a new mesh from a range of points?  In this example I am trying to grab out points 0-25 but it seems like even after I do that more buffer data then I anticipated is still present on the mesh.

So Im thinking my UV projection is not working because my bufferData is wrong.

Any input would be cool.



Never-mind I think i figured it out... after looking at it again this morning.  (dumb loop count error)

Link to comment
Share on other sites

Ok now this gives me a headache...


if you look at the console, all my rays are being cast for no reason as I stripped out all the vertices data from the buffer that I am looping through

console.log(positions.length, "positions length");
for(var i=(skipTo*3); i<(positions.length-trim); i+=3){

There is no reason 26 rays get cast.
Link to comment
Share on other sites

Well then riddle me this:

Why does this not simply "cut" out the section of the mesh that I want.

Also whats up with the errors coming when you click on the scene, I have no mouse listeners bound but default stuff.

Made a PR to get the Lathe object doing what I need:

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...