A question about translation

Hello Everyone,

This is my first post, so I hope I’m posting it in the right place.

I’m going through the second chapter of the Beginner’s guide, which is mostly dealing with box primitives.

The author mentions that when you create a box, if you desire a face to be at the origin, you move it half of whatever dimension you want to be at the origin, since the box’s center is at the origin when it’s created.

So, if I create a box(3, 3, 3), and I want the top face to be at the origin of the y axis, I would translate(0, -1.5, 0). This is what the author told me, and it makes mathematical sense to me.

However, I’m noticing that when I create multiple boxes and make translations in this way, there is overlap and I need to translate the full length of the desired dimension for boxes to not overlap. In fact, they look to be sitting right on top of one another.

So, to recap, I have two boxes, one with a height of 1, and another with the height of 2. I want the the taller box to sit on top of the shorter box, meeting at the origin. Originally I translated the taller box 1.0 on the y axis and the shorter box -0.5 on the y axis, and the boxes still overlap about a quarter of their side faces. Am I missing something? Did I misunderstand what the author intended to say?

Ah the 3 is the extend as in radius not the size,
so what he told you is to use -3, as that is the have of its dimension (the box is 6,6,6 when using extends 3,3,3)

[java]
/**
* Creates a new box.
* <p>
* The box has a center of 0,0,0 and extends in the out from the center by
* the given amount in each direction. So, for example, a box
* with extent of 0.5 would be the unit cube.
*
* @param x the size of the box along the x axis, in both directions.
* @param y the size of the box along the y axis, in both directions.
* @param z the size of the box along the z axis, in both directions.
*/
[/java]

You know, that makes a whole lot more sense. Next time I have questions like this I’m going to open the javadoc.

Thank you for your time.

@bytejunkie said: You know, that makes a whole lot more sense. Next time I have questions like this I'm going to open the javadoc.

Thank you for your time.

Such a good lesson to learn! :slight_smile: You are now all at once miles ahead of so many. Good luck with your endeavors.