I have a “bow” collection:
Then I have an “archer” collection, which has the bow:
Then I have the main collection with an archer in it:
I need to move the archer with input keys up or down, but the following code moves only archer - the bow doesn’t move with it.
function on_input(self, action_id, action)
local position=go.get_position()
local new_dir=vmath.vector3()
if action_id==hash("up") then
new_dir=vmath.vector3(position.x,position.y+3,0)
go.set_position(new_dir)
elseif action_id==hash("down") then
new_dir=vmath.vector3(position.x, position.y-3., 0)
go.set_position(new_dir)
end
end
Bow must be moved with archer. What should I do?