Propblem with node parent-child relation

Hello,



I’ve recently came across some strange behavior concerning parent-child relationship between nodes.

It happened while loading blender file.



I have 3 nodes with the names ‘a’, ‘b’ and ‘c’.

The nodes do not have rotation to make things easier.



The ‘a’ location is [0, 0, 0], it’s scale is [0.1; 0.1; 0.1] and it has no parents.

The ‘b’ is a child of ‘a’ and its global space translation is [1, 0, 1] and scale [0.1; 0.1; 0.1].

The ‘c’ is a child of ‘b’ and its global space translation is [2, 0, 2] and scale [0.1; 0.1; 0.1].



Now when I load those objects happens the following.

The ‘a’ is loaded without problems.

Local translation [0, 0, 0] and scale [0.1; 0.1; 0.1].



When I load the ‘b’ I can see that it’s local translation is [10, 0, 10] and scale [1, 1, 1].

But this is perfectly normal because I know ‘b’ is a child of ‘a’ and when it is put in its parent’s space

it has the [0.1; 0.1; 0.1] scale applied.

So local translation is scaled to [1, 0, 1] and scale to [0,1; 0,1; 0,1].

Ant then ‘b’ appears exactly where I want it to be.



The problems appears when I load the third node.

The ‘c’ object is a child of ‘b’ and in global space it is translated by [1, 0, 1] from ‘b’.

When local transformation is loaded I can see that it has translation of [10, 0 , 10] and scale of [1, 1, 1].

When ‘c’ is attached to ‘b’ it should inherit its scale ALONG WITH ITS PARENT’S SCALE.

But it seems that it isn’t happening.

The location of ‘c’ is [10, 0, 10].



It that a bug or am I doing something wrong?





If someone could take a look.

The test file is in src/test-data/Blender/2.4x/positions.blend



The method that loads the transformation is in class

com.jme3.scene.plugins.blender.helpers.v249.ObjectHelper

with the name

public Transform getTransformation(Structure objectStructure);





There is a fourth object ‘x’ on the scene. But do not pay attention to that :slight_smile:



Cheers,

Kaelthas

I tried this myself and I saw completely different results:

[java]Node a = new Node("a");

Node b = new Node("b");

Node c = new Node("c");



a.move(0, 0, 0);

a.scale(0.1f);



b.move(1, 0, 1);

b.scale(0.1f);



c.move(2, 0, 2);

c.scale(0.1f);



a.attachChild(b);

b.attachChild©;



System.out.println("a:n" + a.getWorldTransform());

System.out.println("b:n" + b.getWorldTransform());

System.out.println("c:n" + c.getWorldTransform());[/java]



The output is:

[java]a:

Transform[ 0.0, 0.0, 0.0]

[ 0.0, 0.0, 0.0, 1.0]

[ 0.1 , 0.1, 0.1]

b:

Transform[ 0.1, 0.0, 0.1]

[ 0.0, 0.0, 0.0, 1.0]

[ 0.010000001 , 0.010000001, 0.010000001]

c:

Transform[ 0.120000005, 0.0, 0.120000005]

[ 0.0, 0.0, 0.0, 1.0]

[ 0.0010 , 0.0010, 0.0010][/java]



As you can see the scale is inherited properly