This topic is 923 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm considering incorporating gesture recognition in my game based on analog joystick input. It sorta screams "neural network" to me, but perhaps there is a more ad hoc mechanism. For example, if you had to draw a circle, some measure of the distribution of how far away the sampled values were from their centroid. That would be fine for simple shapes, though perhaps if I could define a path for each gesture I could still perform a similar trick. I can see problems with that, though, trying to work out which of the sample points belong to which segment of the path. Any ideas?

##### Share on other sites

Hmm you could calculate the whole segment and not just consider the points. This way you could sample a whole shape and not just points.

For example: The user points the joystick upwards, so you save the initial point and add whenever the user changed the angle.

This is of course simplified. You also need to measure the angle which the user directs the joystick, which is a simple sin/cos method.

Edited by WoopsASword

##### Share on other sites

If you wanna detect if a stick is rotated (for example in clockwise order), you have to map the two axes in a vector.
Then you look if a x or y value changes his presymbol (my bad english, presymbol means "+" or "-" for me).
This will result in a change of the actual quadrant of the circle.
And if you now detect this row of quadrant-changes .... you have your move.

You can add maybe a inner radius, so the player has to make a "big rotation" with the joystick.

I hope that wasnt too fast.

##### Share on other sites

a function for this could look like this:

#define QUADRANT_TOP_LEFT 0x01

{
if(actual_stick_pos.x < 0 &&
actual_stick_pos.y > 0  )

if(actual_stick_pos.x > 0 &&
actual_stick_pos.y > 0  )

if(actual_stick_pos.x < 0 &&
actual_stick_pos.y < 0 )

if(actual_stick_pos.x > 0 &&
actual_stick_pos.y < 0   )
}


the you would have to create something like an array with 4 values.
So when the quadrant changes, the old quadrant gets in first place, the rest is shifting back.
Then you have to do a simple check of the array.

##### Share on other sites

a function for this could look like this:

#define QUADRANT_TOP_LEFT 0x01

{
if(actual_stick_pos.x < 0 &&
actual_stick_pos.y > 0  )

if(actual_stick_pos.x > 0 &&
actual_stick_pos.y > 0  )

if(actual_stick_pos.x < 0 &&
actual_stick_pos.y < 0 )

if(actual_stick_pos.x > 0 &&
actual_stick_pos.y < 0   )
}


the you would have to create something like an array with 4 values.
So when the quadrant changes, the old quadrant gets in first place, the rest is shifting back.
Then you have to do a simple check of the array.

Thanks, I have been thinking along similar lines (pardon the pun!). I think it would be better to track octants (a bit more trig, but still quite easy) and it might also be useful to track velocity (or equivalently time between octants). It's not rocket science, but it could work quite well and be more CPU friendly that a neural network trained on patterns!

1. 1
2. 2
3. 3
Rutin
20
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633655
• Total Posts
3013175
×