So I’m looking at some examples and it uses
transform.Translate(5f,0f,0f);
What is the 0f and 5f notation called and what is it for please?
So I’m looking at some examples and it uses
transform.Translate(5f,0f,0f);
What is the 0f and 5f notation called and what is it for please?
Those are float values. 0f = 0, 5f = 5 and 1.2f is simply 1.2 just in float notation. On the other hand, in C# if you leave out the f you will likely get a warning or an error. float is a floating point number whereas int is integer, which does only represent full numbers (1,2,3,4,…) . But because transform.Translate does only take float parameters you must add these f’s in C# (not in JS)
f - means float. In this case you could just write transform.Translate(5,0,0); - it doesn’t matter. But in cases where you write floating point numbers like 3.14, you might need to add f - 3.14f in order to tell compiler that it’s a float not a double, otherwise compiler will give you a warning.
There are totally we have 3 kind of axis like "X, Y, Z "
transform.Translate(5f, 3f, 4f);
5f=5, 3f=3, 4f=4 we can put directly like (1.5), (2.5)