I want to rotate the spear to the chicken when it is moving. I use the code from the rotate example but does not work. I do not have the camera game object. How can I make it work?
This is my code
local to = go.get_position()
local from = go.get_position("chicken")
local angle = math.atan2(to.x - from.x, from.y - to.y)
rotation = vmath.quat_rotation_z(angle)
print(angle)
go.set_rotation(rotation)