Input action moved feature

#1

Hi, I am @Grass_dev

I would like to suggest that please make action.moved script for users…

thank you…

0 Likes

#2

You can do something like:

local offset_x = 0
local previous_x = nil

In on_input

if action.repeated or action.pressed then
    local current_mouse_x = action.x
    offsetx =  (offsetx + current_mouse_x - (previous_x or current_mouse_x))
    --Set limits if necessary
    --offsetx is the change in coordinate x between action.pressed and action.released
end
if action.released then
    previous_x = nil
end

You can replace the coordinate with y or track both

3 Likes

#3

We already have action.dx and action.dy to give you the delta movement of an input (e.g. mouse or touch). Documentation.

If that doesn’t work for you, please explain a bit further for us to understand your use case better.

5 Likes