# 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?
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. Bad usage of english language. Of course, my right is always to the right 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

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 than mine will kick-in

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

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

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 Thanks for kicking-in. I think this is beyond my expertise

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

1 Like

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

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 If he canāt do it, nobody can and we will likely just have to redefine the laws of geometry As for me, as everybody should know, Iām only here for the jokes Thatās what I do best Hope youāll find what you are seeking and meanwhile, have an awesome weekend