Camera configuration not changing

I’ve set up a camera in my game that will follow the player. But i’d like to to be more zoomed in on my player. Below is the code that causes the camera to follow the player in the player script:

	msg.post("camera#level1", "acquire_camera_focus")

Below is the current configuration of the camera:
image

I know the camera is properly attached to the game as the screen moves with the character but no matter what i do the camera settings dont change the game which is not only a problem because the player is zoomed out but also because the background wont load in (because its negative on the Z axis). Has this happened to anyone else?

You set Near-z to 0.1, that means everything with z<0.1 will be outside of the camera box and will not be rendered.

set it to Near to -100 and Far to 100, for example, to render all the object with z in -100…100 range.

If you want to use camera projection, send the following message to the render script:

msg.post("@render:", "use_camera_projection")
1 Like

ooh that makes sense, thank you very much, that fixed the background issue but ive been messing around with the code that follows the player.
This is the code in the player script:

	msg.post("@render:", "use_camera_projection")
	msg.post("camera#level1", "acquire_camera_focus")
	msg.post("camera#level1", "follow")
	self.follow = true
function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then -- <4>
		self.follow = not self.follow
		if self.follow then
			msg.post("camera#level1", "follow")
		else
			msg.post("camera#level1", "unfollow")
		end
	end
end

and this is the code in the camera script:

function on_message(self, message_id, message, sender)
	if message_id == hash("follow") then 
		go.set_parent(".", sender)
		go.set_position(vmath.vector3(512, 382.5, 0))
	elseif message_id == hash("unfollow") then
		go.set_parent("camera#level1", nil, true)
	end
end

One problem i’ve encountered that when i use the camera projection the camera doesn’t centre the player in the middle of the screen. I did some tinkering and found that when i changed the FOV it looked like it did not focus on the player but a random point in the screen. So i looked at the code and thought the code below was renpossible for setting the focus of the camera I changed the coordinates from -360, -360, 0 to 1/2 of my aspect ratio (1024x765) which makes it 512, 382.5, 0. This also didn’t change anything, lastly i set it to the URL of the character sprite but this also didn’t do anything. Do you guys know what could cause the camea to be focused so only 1/2 of the level is on the screen?

go.set_position(vmath.vector3(512, 382.5, 0))