Hello, i’ve recently found Defold so I’m very new to Defold and I’ve been testing around and currently I’m trying to position the camera so the player is in the center of the screen (I have followed this tutorial to achieve this), I know that if I just position the camera to the player’s position the player would appear on the bottom left corner of the screen so I know I should offset the camera by half the screen width and height, but the player doesn’t appear in the center of the screen, I’ve been searching in the forums but I still have not found a solution to this problem. Here is a screenshot of how it looks:
And here’s the code that positions the camera:
function init(self)
msg.post("#Camera", "acquire_camera_focus")
end
function on_message(self, message_id, message, sender)
if message_id == hash("follow") then
local width, height = window.get_size()
go.set_parent(".", sender)
go.set_position(vmath.vector3(-width/2, -height/2, 0))
elseif message_id == hash("unfollow") then
go.set_parent("Camera", nil, true)
end
end
Is there something I could do to position the camera properly?
Thanks in advance
Btw sorry for my bad english, english is not my main language