Hi all,
I have setup keybinds to move objects on my application.
They work 90% of the time, moving objects up, down, left right.
When however, a button is spammed, such as the right arrow, it will work 90% of the time and then stop. I have identified the issue, but not sure of the solution.
Basically, the code gets the object.position.x and then just adds or minuses from it, so for example, console logging the intended position might be 0.075 intervals
[-0.475, 0, -0.45] // correct [-0.475, 0, -0.525] // correct [-0.475, 0, -0.6] // correct [-0.475, 0, -0.6] // incorrect - repeating same position [-0.475, 0, -0.6] // incorrect - repeating same position
I think, however, when the button is pressed over and over, the object.position.x is old, maybe due to state updates, single threaded JS, or something.
I have attached a gif and the relevant code block, if anyone has any pointers would be appreciated!