Better title suggestions are welcome.
I was working on a function that converts a world vector to a camera-local vector. It looks like this
Vector3 camAlignedMovementDirection = MovementDirectionToVector(movementDirection);
//We don't care about verticality.
camAlignedMovementDirection.y = 0;
camAlignedMovementDirection.Normalize();
return camAlignedMovementDirection;
Note that the actual code isn't that important. However I was conflicted with the naming of the particular function. At first I was using this:
private Vector3 GetCamAlignedVector()
{
//Code
}
But I realised I could simply just do this:
private Vector3 CamAlignedVector
{
get
{
//Code
}
}
So I was wondering, which is the preferred style, and why, what are the pro and cons, are there any "common" rules to follow? Because (from my knowledge), both functions do exactly the same thing, and work exactly the same way.
One thing I realised myself is that by not using "Get" I will not clutter intellisense with a bunch of getter functions, and I'd personally say that's an "advantage", albeit minor.