Camera Projection Mode via C++

Hi,

I want to set the Projection Mode of my Camera to orthographic via code, but I am failing to find the right Syntax.

My approach is:

CameraComponent->ProjectionMode->EnumType = Orthographic;

which apparently fails to compile.

Can somebody point me to the right syntax?

Thanks

1 Like

Hi Hermi,

You want to use CameraComponent->ProjectionMode = ECameraProjectionMode::Orthographic;

ECameraProjectionMode is a namespace, hence the :: usage. The reason we use this pattern for many enums in the engine is because enums in C++ ‘pollute’ the scope that they are contained in (otherwise a word like Orthographic would be globally reserved and we’d have to prefix it with something).

Cheers,
Michael Noland

Great, thank you!

The explanation makes sense too