Archive 17/01/2023.

[StupidMistake] How to change camera’s Zoom?

Vagabond

In the staticScene sample I tried this (Changed line 120 and inserted a new one below it):

119 | cameraNode_ = scene_->CreateChild("Camera");
120 | Camera* camera = cameraNode_->CreateComponent<Camera>();
121 | camera->SetZoom(1.0f);

But as no matter what value I placed in there the view was the same every time I compiled and ran that sample, here I am.
Edit: Remembered I had changed the target name in my CMakeLists.txt file… Sorry for wasting your time. :blush:

rasteron

Hey Vagabond,

First of, Welcome to the forums! :slight_smile: I have not tested this in C++, but in Angelscript it is done by:

cameraNode = scene_.CreateChild("Camera");
Camera@ camera = cameraNode.CreateComponent("Camera");    
camera.zoom = 0.1f;

You should probably check if you just need to do a clean and rebuild of your executable.

Pyromancer

In the vein of rifle scopes and the like, you could also potentially move the camera on the look vector a certain distance and rotate it around the current “real” position of the player.

So your scene hierarchy would be a root node that moves and rotates he camera, then the camera itself as a separate node parented to that root node.