SvarogZ
(SvarogZ)
November 30, 2017, 8:55am
1
The task is to change the size of StaticMesh from C++.
There is base C++ class. StaticMesh is choosed from BP class.
I want to use the same BP for different sizes.
From Blueprints I can do it here (see picture). Is it possible to do the same from C++ for one copy only? Or advise the way to do it proper. Textures should not be resized.
Firefly74
(Firefly74)
November 30, 2017, 10:13am
2
Not Sure exactly what you want, why don’t you simply scale the component ? (UStaticMeshComponent)
UStaticMeshComponent* staticMesh;
staticMesh->SetWorldScale3D(FVector(2, 2, 2));
staticMesh->SetRelativeScale3D(FVector(2, 2, 2));
1 Like
SvarogZ
(SvarogZ)
November 30, 2017, 10:54am
3
In that case textures on the edges are stretched also.
You could change the material so that the edges won’t stretch.
Firefly74
(Firefly74)
November 30, 2017, 12:32pm
5
Now i know what you whant, I would recommend you to do it in material to avoid having to manually code dynamic scaling.
Material has a TextCood node, multiply it with the object scale node and ‘voila’
You should keep a correct scale ratio. but i don’t think there is a magic solution for that case
SvarogZ
(SvarogZ)
December 7, 2017, 8:52pm
6
Yes. Thank you.
I can’t do exactly the same.
I have to use one BP material.
There are 3 materials (one for opposite sides of a cube).
DataAsset contains size scale, material and other information.
Using C++ I can change any scale of the cube and adjust UVs in BP already.