Camera Not Working (SOLVED)

Hi, I hope that everyone is doing well. I have run into a weird issue with the camera.

Here is the init for the camera

function init(self)

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


self.velocity = vmath.vector3(0, 0, 0)
self.correction = vmath.vector3()
self.ground_contact = false
self.anim = nil
end

Here is how I have it set up:

And I am getting an error saying:
ERROR:GAMEOBJECT: Component '/player/player#camera' could not be found when dispatching message 'acquire_camera_focus' sent from default:/player/player#player

Any ideas?
I have tried the with and without the “#” in front of the camera in the script.

Thanks!

Try using /camera#camera as the URL.

Ok, that returns a different error:

ERROR:GAMEOBJECT: Instance '/camera' could not be found when dispatching message 'acquire_camera_focus' sent from default:/player/player#player

Very weird.

If you click on the camera component, what is its Url property? That should be the right one to use. Also, make sure to rename your collections from default.

/camera#camera

The Camera GO is /player/camera

Yes, thanks for bringing this up, I always forget. Just made that change.

Then try /player/camera#camera as the URL.

1 Like

This worked, thanks!
Silly mistake on my part, I appreciate it!

1 Like

Another quick question, how can I center the camera on my player? Right now I only see the corner of it’s face.

Move the camera GO to your player’s coordinates.

1 Like

Wonderful, thanks!

1 Like

Also, consider the Orthographic camera extension:

2 Likes

For sure! Traditionally I would use Orthographic but this project is for a Hackathon where libraries or external code cannot be used. Thanks!

1 Like