this is the error:
ERROR:SCRIPT: main/player.script:6: bad argument #1 to ‘vector’ (table expected, got number)
stack traceback:
[C] in function vector
main/player.script:6: in function <main/player.script:1>
INFO:DLIB: SSDP: Started on address 192.168.1.111
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
ERROR:SCRIPT: main/player.script:45: attempt to call field 'lenght' (a nil value)
stack traceback:
main/player.script:45: in function <main/player.script:32>
this is the script:
function init(self)
msg.post(".", “acquire_input_focus”)
self.moving = false
self.firing = false
self.input = vmath.vector3()
self.dir = vmath.vector(0, 1, 0)
self.speed = 50
end
function final(self)
msg.post(".", "release_input_focus")
end
function update(self, dt)
if self.moving then
local pos = go.get_position()
pos = pos + self.dir * self.speed * dt
go.set_position(pos)
end
if self.firing then
local angle = math.atan2(self.dir.y, self.dir.x)
local rot = vmath.quat_rotation_z(angle)
local props = { dir = self.dir }
factory.create("#rocketfactory", nil, rot, props)
end
self.input.x = 0
self.input.y = 0
self.moving = false
self.firing = false
end
function on_input(self, action_id, action)
if action_id == hash("up") then
self.input.y = 1
elseif action_id == hash("down") then
self.input.y = -1
elseif action_id == hash("left") then
self.input.x = -1
elseif action_id == hash("right") then
self.input.x = 1
elseif action_id == hash("fire") and action.pressed then
self.firing = true
end
if vmath.lenght(self.input) > 0 then
self.moving = true
self.dir = vmath.normalize(self.input)
end
end