How to re-position or re-scale a cube using positions of other meshes

Hi,

In the following playground, I have a cube and spheres positioned on 4 corners of that cube: https://playground.babylonjs.com/#LZNB1V#7

These spheres are supposed to work as size controllers of the cube as illustrated in the following video:

Untitled

My code works for an un-rotated cube as in the video, but doesn’t quite work with a rotated cube (in the playground).

I would really appreciate it if you could help.

Any reason you are not using the Babylon.js gizmos?

Hi @JohnK !
I did find out about that example.
It’s very neat but I have to implement these behaviors in my React project so I can’t use those out of the box

try a search in the forum ‘gizmos with react’

Closing as duplicate Re-position or re-scale a cube using positions of other meshes