I see something like this new BABYLON.Animation("slide", 'position.x', 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
and it would slide on the x position.
but something like this for the NME does not work
but if i get the value and set it inside material like this
material.test_value = material.getBlockByName(“test_value”);
and run the animation like this, it works. new BABYLON.Animation("slide", 'material.test_value.value', 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
is there a way to get getBlockByName to work or is there a different way i should be doing this?
i am trying not to set a local value since these values could be anything.
since you cannot do material.attachedBlocks[12].value doing .12. worked. i assume getBlockByName() just goes through the attachedBlocks and looks for a name thats the same and returns that.
so i still have the question of: Is there a better way?
Only properties can be used in the property name, because the code is retrieving the value by doing property = property[index].
So, if propertyName is material.nodeScale.value it is doing:
property = sphere["material"]
then property = property["nodeScale"]
then property = property["value"]
You can see it won’t work if you have something like getBlockByName('NodeAlpha') as this is a function call, not a property. We would need to do something like eval which is not possible.
So I guess what you did is the best you can do, but as you said it’s really depending on the position of the block in the attachedBlocks array…