DefOS and Rendercam - 3D game

Hi folks

I am making a 3D, first person shooter using defold. (not high performance, but for fun). I want the camera to follow the mouses movement, and rotate the game object (parent of camera) with it. Currently I am using DefOS and defos.get_cursor_pos_view() to get the coordinates of the mouse. I then want to update it, so that when it changes, the player (game object) also rotates.
My question is, how would i go about doing this? I have looked at https://github.com/subsoap/fps this, but I can’t seem to understand this.

Additionally, when i run my game i encounter an issue of a black wall being in front of the camera. My assumption is that it is from me misunderstanding Rendercam’s settings, and having the view distance/near/far Z set wrong. I am using a perspective camera.

Thanks in advance

1 Like

My post doesn’t answer your question at all, but I suppose it can help you.

Take a look at this extension - Pointer Lock for Defold.
It doesn’t use DefOS. It has an example of a mouselook and an exceptionally simple 3d camera script. And check out my FPS game from the previous Ludum Dare (Oh, I promised to make an FPS template for Defold in the topic. I’m still working on it…)

5 Likes