I’m trying to write a bit of code that will rotate the Game Object when the right arrow key is held. My code is:
function on_input(self, action_id, action)
-- Add input-handling code here
-- Remove this function if not needed
if action_id == hash("right") then
rotation = go.get_rotation() + vmath.quat(0, 0, 1, 0)
print(go.get_rotation())
go.set_rotation(rotation)
end
end
Whenever I build the game and press the right arrow key, it gives me the error:
Line 39 being where I define “rotation”, and line 35 is the on_input function.