I’ll split my question into two parts, so I also provide two examples.
First question is how to swap axes of rotation, so the fan rotates as it obviously should in practical use.
Subquestion, which doesn’t need to be answered is, if you open NME for the “0_fan” and connect the unused result of adding two vector3s to the vector splitter, the fan is moved up by 2, but axis of its rotation is misplaced. Is there an easy fix?
I programatically filled the cylinder with water on lines 28-41. Could this be achieved of transformation using NME on “0_inner”? If yes, how? If this question is trivial, please, is there a part of documentation on nme that im missing where I could read about this?
Also I’m thinking that I want to transform mesh using material editor, which could be mixing apples and oranges, but seeing how powerful the nme is, I think it might be achievable. And if it’s not achievable using nme, is there other tool except for code, that i could use?
You should rotate around the Y axis, not the Z axis:
With this change, connecting the
Add block to the vector splitter does work as expected.
Regarding your 2nd question, I think doing it as you do is the easiest way. Trying to do it in the material would be difficult because you would need to know which are the vertices corresponding to the top of the cylinder to be able to change their Y coordinates. It’s a lot simpler to simply change the Y scaling as you did.
Thank you for the corrected playground.
As for the second question, I need user to manipulate the liquid height without using the code, because I don’t want to use eval() and risk security of my project. I was thinking I could use the Transform node, but it needs matrix as input and I don’t quite understand how to use it. Second thought was to scale the original height, but as original was 0, it cannot be achieved by multiplying, so I was thinking changing the original of glb model to something like 0.0001.
Could you provide a simple example that would take least amount of your time, to move height of liquid from zero to any other positive number? I would then spend my time finding the exact needed constants, I just wasn’t able to move it at all.
You can do it like this:
Note that in the PG I set a pivot point at the base of the liquid, so that when scaled, it would only extend upward.
I am sorry, I might have asked my question incorrectly. I am not trying to animate the motion of filling up. Even though it was also useful piece of info, thank you.
I’m trying to manipulate the height of “inner” variable without using any code. Only NME. Setting it once to a value that is bigger than zero would be enough. Although I cannot find any documentation for it, I think it should be possible do using NME, since I was able to rotate the fan. I thought changing height wouldn’t be too different.
Is it possible with exactly this code only opening the Inspector, going to Materials and changing nodes and values in “0_inner” using NME?
I’m also trying to provide an example, but I’m unable to come up with something remotely close in my NME session. I’m sorry.
You can multiply the world matrix by a custom matrix that would scale the Y axis:
You would need to change the 0.5 value in the row1 Vector4 to change the liquid height.
Also, for it to work as intended, you need to set an initial Y scale to 1 in your model.