Forum

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 :)