Hitest on a cylinder end in 3d?

Hello,
i m actually building for one of my performance a 2m long stick, with in its middle a MPU 9250 (gyro+accelerometer+compass). The idea is to activate hitest zone when pointing in a defined direction. Its relativ to my body ( up right, down left, middle front ect…).

I m receiving good data in a Yaw Roll Pitch format from the arduino library used But… i m wondering of to create hitest zone in 3d, intersecting only one end of my cylinder simulation.

On the patch here you will find a representation of the stick and its orange tip, wich should be recognized when touching one of the two 3D targets.

Thank for your help !

HITEST IN 3D.v4p (34.3 KB)

VL has some useful nodes for simple CPU-based hittest, there’s one called BoxContainsPoint that I wrapped to be used in beta world.

Modified your patch a bit so that those boxes turn green when the tip intersects them. Quickndirty test, so please review that :)

karistouf_hittest.zip (16.0 KB)

1 Like

Thank you Sebescudie ! thats it (hit) ! thanks a lot for this perfect tool :) you made my day !

1 Like

Glad it works!

yes its great ! now fighting with the mpu9250 just to find out how to avoid inversion of data if Z axe is inversed ( roll). I dont know if there is any tool enabling compensation on this classical state of devices ?
thank you again :)

Never worked with such devices so could not recommend anything there, except for the Sign node, but again, not even sure if relevant for you there.

Also, better start a new thread, since this one is resolved!

thank you ! :)

hey for 9250 you have to use the super nice hideaki tai library https://github.com/hideakitai/MPU9250, it gives relative pos based on calibration i used it in esp32 and worked perfectly https://github.com/guishade/esp32-oled-bat.git

thank you graphicuserinterface, alrady using it :) yes the madgwick implementation is working fine, and now calibration is ok :)

for stuff like this its also good to remember the http://www.wekinator.org/. i think VL has a nuget for it.
especially if your input data gets crazier. let AI do the heavy lifting.

Thank you soundreactor, i didnt know this tool.

dear @sebescudie would that be possible to add a rotation parameter to the hit box in 3d ?
sheers and thank you for all

Hey @karistouf, here’s an example that handles rotation. Boxes are now defined by Transform rather than Center/Size.

Hope that works for your!

karistouf_hittest_rotation.zip (12.8 KB)

++

Thank you SO MUCH !!! :)
i owe you a tone of beers

1 Like

@soundreactor
i had a look inside wekinator, at videos, and the idea of “machine learning” and did some tests. Helas, Trained model is just a kind of queue, plus mapping and noise cleaning.

by machine learning i was hoping a somehow “magical” program learning from the moves i m doing, enabling complexees identifications: hey this a 8 figure, hey this is a break, hey you are up to down ect…
anyway continuing reasearch for it, i think there is an old developpement of learning gesture somewhere…

thanks again

You should be able to do that with Wekinator. Recognizing an 8 figure, going from top to bottom : sounds like a Dynamic Time Warping thing.

If not willing to use Wekinator though you could use motzi’s machine learning pack. He also did two vveekend vvorkshops on the topic : part1, part2, at some point there’s an explanation on how to recognize a gesture, which sounds like what you’re after.

Hello sebescudie i have done a lot of test this morning. Ok, i need to check back so, maybe the simplest interface of wekinator didnt bring me to the right way to handle it. as i saw also an old post of you quiet enthousiastic with wekinator :) Thank you for leading motzi’s machine learning pack. thanks a lot !!!

This tutorial on Dynamic Time Warping in Wekinator should help you :

In this case, she’s controlling the game with her voice, but it’s the same idea behind gesture recognition.

Yes it helps, i didnt noticed on start this possibility to be in time warping.
but i dont have any result… cube detection is perfect, so i can output some logical from it ( smashing from up to down and so on), but having the figure of the two handed spinning wheel would be really a big plus. Some doubt as my data are inverted when spining the stick…
Here is a link to understand the spin i m searching to detect with the IMU, its the first one : https://www.youtube.com/watch?v=ZsuVokk6Zrk

The inversion of z and y maybe the problem when rotating …

maybe more clear here: https://vimeo.com/760357999