Relative positions between nodes belonging to different parents

I have one node whose parent is the canvas and 5 other nodes which are children of grandchildren of the root node. I want to move objects from the node which belongs to the root node to the 5 nodes. Therefore I need to find out in vector the relative distance from the source node to each of the 5 nodes. Is there an easy way to get it done?

The root node you are referring to is the scene node, correct?

Could you please upload your scene resources?

I was trying to upload my scene file but cannot because the scene file is not in the accept list. Let me upload the file on the server and paste the link. http://jsonblob.com/1158388259394281472 .

Hello there!

I did some hardcore Google-ing to discover the mathematical formula to obtaining the distance between one 3D point to another. Then I converted it to Typescript for you:

    Square(value: number): number {
        return value * value;
    }

    Distance(from: Vec3, to: Vec3) {
        return Math.sqrt(
            this.Square(from.x - to.x) +
            this.Square(from.y - to.y) +
            this.Square(from.z - to.z)
        );
    }

I tested the formula in another programming language and it checked out perfect, so I know the math is correct. To use it, just copy that into the script that you need the distance in and then call the Distance function like this:

this.Distance(pointA, pointB);

It will should return the distance as a number.

I hope this helps you!

I have now opened your scene file. Please mark the node relationships you described on the scene nodes for me to analyze your requirements