Moving Cube by scripting sphere position

What i want is to move a cube by knowing position of three corner.

I tried hierarchy (sphere inside cube ), but cube is ejected.
I also try to put sphere under cube, but cube slips…

Hello,

I’m having a hard time understanding what you want. You know 3 of the 8 corner point positions of a cube, and you want to move the the rest with it? Which corners do you know already? lets say you know bot1 corner, and bot2 corner, and bot3 corner. You can potentially find the length between corner1, and corner2. (A) And the same with corner2 and 3. (B)
We can’t assume this cube is upward in Y(could be rotated?), so Use the cross product to get the perpendicular angle of the segment of corner1, and corner2. and use A as the length to add for the next point for top1 point. use this method to get the rest.

have i mis-read what you need? Confused on how this applies to games.

Perhaps you mean, you want to animate a cube to 3 vector positions. In this case, use LERP or SLERP, over time, or get the vector direction from your starting position, to point1, then from point1, to point2, etc. Use transform.LookAt() to get the object to look in the vector direction as well.

Hello DDelapena,
In fact, i have three 3d points and i wanna match them with a cube.
I hoped that it will be possible thanks to physics and cube parameter.
But yes, i can compute them and apply rotation and translation.
It’s not really for game yet, just for visual testing.