Thanks again for your advice regarding "Unscale U."
I followed the code a bit.
I am happy to report that I was able to find the number of texture iterations with the following code.
I'm a little aggressive in asking for "aspectCorrectionV," but that probably won't be a problem.
I have also confirmed that UV scrolling is possible using the above code.
I confirmed that the speeds also match those of other objects in 3D space.
The "ScrollTf" is a value between 0.0 and 1.0. In reality, I am running the code with a few more tweaks.
Anyway, this is what I wanted to do.
Thanks for the great support!
I followed the code a bit.
I am happy to report that I was able to find the number of texture iterations with the following code.
Code:
public static float GetTextureRepeatCountV(out Material mat)
{
BuildVolumeMesh volumeMesh = VolumeMesh;
// Get the Material being set
mat = volumeMesh.GetMaterial(0);
// Get UV Scale
CGMaterialSettingsEx matSetting = volumeMesh.MaterialSettings[0];
Vector2 uvScale = matSetting.UVScale;
// Obtain the vertical aspect ratio of the texture
CGVMesh vMesh = (CGVMesh)volumeMesh.OutVMesh.Data[0];
float aspectCorrectionV = vMesh.UVs[vMesh.UVs.Count - 1].y;
return mat.mainTextureScale.y * (uvScale.y * aspectCorrectionV);
}
I'm a little aggressive in asking for "aspectCorrectionV," but that probably won't be a problem.
I have also confirmed that UV scrolling is possible using the above code.
Code:
public static void ScrollV()
{
// Get the number of V iterations of the texture
float textureRepeatCountV = GetTextureRepeatCountV(out Material mat);
// UV scrolling
mat.mainTextureOffset = new Vector2(0, -ScrollTf * textureRepeatCountV);
}
I confirmed that the speeds also match those of other objects in 3D space.
The "ScrollTf" is a value between 0.0 and 1.0. In reality, I am running the code with a few more tweaks.
Anyway, this is what I wanted to do.
Thanks for the great support!