Centering The Camera

Hello everyone, I’m new to defold/Lua and I am fairly inexperienced so go lightly on me!

I was following the camera tutorial which enables the camera to follow the player which all works fine, however it is not centered on the player. I have tried to use the co-ordinates used in the tutorial to offset the camera which doesn’t seem to work, I’ve tried putting in my own values but nothing seems to change. The player is always stuck in the bottom left of the screen. Any help would be much appreciated!

The code I’m using:

`	if message_id == hash('follow') then
	go.set_position(vmath.vector3(-360, -360, 0))
end`

Thanks again!

Let me clarify your situation.

  1. You mentiond “camera tutorial”. Is that mean this? → Camera

  2. (In case 1. is correct), you seemed to remove go.set_parent(".", sender). Is it because it doesn’t work?

2 Likes