Hi there, I was just wondering if there is a way to select the last mesh that a ray goes through?
Hi there! I tested this in a playground but I assume this to always be true and work. I filter it to both meshes and then pick the last one (assuming it’s ordered in the order they are hit).
Edit: Updated to correct playground link.
Hi msDestiny, thanks for your response.
I am fairly new to programming, so bear with me. In the playground you have provided, is the far away cube programmed to respond to the ray? In other words, if there was another cube behind that, with no alteration to the code, would it start to scale up?
I thought I should provide a playground Here you will see a box behind another mesh. Click the mesh and the whole scene moves forward. I want to click through the mesh to the box and have the scene move, with the box becoming the centre of attention.
And to take it further, if there was a random number of boxes, spaced out immediately behind the original box, I want the last box to be picked and have that move towards the camera and be the centre of attention. All without changing any of the code.
And of course, all the meshes described should be semi-transparent so you can see through them to pick…I just haven’t done it here.
Hope this makes sense.
Let me take a look at your example and get back to you
Oh my goodness! I sent the wrong example! (I had a couple of playgrounds up). Let me fix that for you!
As you can see I added another mesh and it is not picking that one instead.
Hi again, I thought I would share with you my previous playground trying to solve my issue This is from post four of an earlier thread I made I feel I am so close to getting this to work: picking meshes through walls and moving the camera to them.
If I could just adapt this to always picking, and moving to, the furthest away mesh I believe I would be on to a winner.
Just to let you know, I tried creating another box behind the furthest in your playground with no result. I don’t think it is quite the wiring/programming I am after…although I may be wrong.