Is one box to the right or left of the other box?

Hello, I would like to get your opinion on a problem that I cannot solve. I have two boxes. One of the boxes is movable and the other is immobile. My moving box moves around the stationary box.

What I want to learn is whether the stationary box stays on the right or left of the moving box. I hope I explained it in a simple way :). I request your help on the matter.

Panning ArcRotateCamera | Babylon.js Playground (babylonjs-playground.com)

Lol. Interesting question. If I turn myself on 180° then my left is to the former right, correct? :grin: :wink:
So, jokes apart, I’d say the left and the right depends from the point of view (or the look from the camera).
Assuming that your zero position would be the zero alpha of the camera, currently your object is neither to the left or to the right (from the zero alpha position of the camera) but behind it!

1 Like

:). You are wrong. Your right is always your right. Think of it like your right arm :). The purple corner is to the right of the box. Because if we want to turn right, it turns in that direction. In the other corner is the left side :).

haha, yes. :rofl: Bad usage of english language. Of course, my right is always to the right :grin: That’s what I wanted to say when saying it depends from the view of the camera. But then I still don’t understand, what was your problem exactly?

1 Like

power of the Translator :). With the simplest repair, I need to know that when I pass the motionless box, that box is on my left. That’s all. Sorry for the translation mistakes :slight_smile:

When you say “my left”, you mean from the view of the camera? or do you mean on the left x-axis?
Is your issue related to left-handed vs right-handed system? I’m sorry, I must be dumb.
Hopefully somebody else with a bigger brain :brain: than mine will kick-in :crazy_face: :dizzy_face:

1 Like

Please don’t insult yourself :). It’s just translate’s fault :). When I say left side, I mean the left side of the box. So purple corner. My problem is that I don’t know how to find the answer :). The answer I want is; Is the white box to the left or right of the colored box? answer to your question :slight_smile:

Don’t know what to say.
Below is what I see when I open your PG. For clarity, I added local axes to the boxes.

So, in my view scenario, the purple face is on the outter part of the object from the center object. The blue/azure part is facing the white cube object and the moving object is slightly displaced to the left on the x-axis. While the white cube is displaced to the right (positive value) on the x-axis from the zero world origin.
So, in short, I’d say that on the x-axis, the moving object is currently to the left (negative value) of the white cube. That’s really all I can say.

1 Like

In the PG that follows I have re-colored the box so that each side is clearly of a different color. I have also named all the side positions so they correspond to the front (green) of the box.

So currently in the PG the white box is on the right of the colored box. You cannot just say the white box is on the left or right without a reference to some other place or object with a known forward position.

In this image

image

  1. the white box is on the left OF THE SCREEN
  2. the white box is on the right OF THE COLORED BOX (as the green face is the front face)

If you decide to make the yellow side the front of the colored box then the white box would be in front of the colored box.

1 Like

The more I read the less I understand what we are doing here :joy: Thanks for kicking-in. I think this is beyond my expertise :rofl:

1 Like

I remember there was a classic sci-fi story where astronauts needed to explain the difference between left and right to some alien in order to survive :slight_smile:

1 Like

Yes, I remember this one too. Oldies like us do remember these things :joy: :rofl:

2 Likes

Dear Jedi mastes, it’s a pity I haven’t found an answer, but it’s good to see you having fun :). I’m still working on the situation. When I find a solution, I will share it with everyone. In all sincerity, thank you so much for trying to help. I love Babylonjs a lot :).

You can use two rays from box A, one going to the left and the other to the right. Depending on which of the two rays intersects the other box B, you will know where box B is in relation to A. You can also use multiple rays for each side if you want a more accurate detection.

4 Likes

see @farukcelim There comes the guru :man_superhero: :man_superhero: If he can’t do it, nobody can and we will likely just have to redefine the laws of geometry :grin: As for me, as everybody should know, I’m only here for the jokes :joy: That’s what I do best :wink: Hope you’ll find what you are seeking and meanwhile, have an awesome weekend :sunglasses: