Translate works but loc.set does not!

#1

I am new to Armory! I am just adding an object through spawn object at the init event of another object like this:
Scene.active.spawnObject(“Boom”,null,function(cube:Object){
cube.transform.loc.set(2,2,0);
});

The code does add an object, even at the right position according to trace (cube.transform.loc.x);
But it does not appear on the scene.

Also, when using a translate function, everything works fine. I can get behind the problem if I want to by using translate but want to know if I am doing anything wrong.

0 Likes

#2

Try calling cube.transform.buildMatrix(); after cube.transform.loc.set(2,2,0);

2 Likes

#3

Yes, it works! Thanks a lot. Did not know this is needed!

2 Likes