luacameradefold

Why is the defold rendercam crashing in self.data.lpos?


I'm trying to use the rendercam, but it is giving me this error:

ERROR:SCRIPT: /rendercam/camera.script:147: vmath.vector4 only has fields x, y, z, w.

stack traceback:
[C]: in function '__index'

I looked through the code and found self.data as a container with lpos = self.lpos. lpos is assigned to go.get_position(). The error is in the line self.data.lpos = go.get_position(). How is this causing an error and what can I do to fix it?

I've tried printing its position (which seems to be the problem) but the same error is thrown when it put print("position is ", go.get_position()) in any place other than init.

ERROR:SCRIPT: /rendercam/camera.script:139: vmath.vector4 only has fields x, y, z, w. stack traceback: [C]: in function '__index' /rendercam/camera.script:139: in function /rendercam/camera.script:137


Solution

  • It turns out I accidentally assigned ob as a vmath.vector3 when trying to make ob.velocity a vmath.vector3.