My object shakes when i put finger on it.
You need to provide a little bit more information than that. Specifically your on_input() code and any other information that is relevant (like your input bindings)
function on_input(self, action_id, action)
if action_id == hash("touch") and #action.touch == 1 then
msg.post(name, "stop_rotation")
count_touch = 0
for i, tpoint in ipairs(action.touch) do
go.set_position(vmath.vector3(tpoint.x, tpoint.y, 0), "invisible")
pprint(tpoint)
end
elseif action_id == hash("touch") and #action.touch == 2 then
if count_touch == 0 then
msg.post(name, "activate_rotation")
count_touch = count_touch + 1
end
if action.released then
count_touch = 0
msg.post(name, "stop_rotation")
end
end
end
I don’t see anything wrong with the code and I tried a similar thing myself and I wasn’t able to observe any “shaking” of the game object I had following the one-finger touch. When does it shake? Always? When you hold the finger still or when moving? When alternating between one and two finger touch?
I tried your code as well and couldn’t get anything to shake.
Not sure how you tied up your gameobjects to this script and what “invisible” really is but I cannot see any problems.
Though I would recommend you NOT to use action.released in the code but instead use the specific touch.released in touch.
i dont understand but now all going well. I dont know why but thanks that you answer the question.