Add angle check for triggers touched by hand

This commit is contained in:
Petr Bartos 2023-03-30 17:54:33 +02:00 committed by Simon
parent 78f7d9bcfc
commit 926c64c691
2 changed files with 16 additions and 0 deletions

View file

@ -1385,6 +1385,14 @@ void G_TouchTriggersWithHand( gentity_t *ent, vec3_t src, vec3_t vf ) {
continue; continue;
} }
// In case touching button-like entity via use gesture, check activation angle here.
// Existing check in g_trigger.cpp Touch_Multi is problematic because we do not have
// there information by which hand was entity triggered.
if ( DotProduct( hit->movedir, vf ) < 0.5 ) {
//Not Within 45 degrees
continue;
}
touched[i] = qtrue; touched[i] = qtrue;
memset( &trace, 0, sizeof(trace) ); memset( &trace, 0, sizeof(trace) );
if ( hit->e_TouchFunc != touchF_NULL ) { if ( hit->e_TouchFunc != touchF_NULL ) {

View file

@ -856,6 +856,14 @@ void G_TouchTriggersWithHand( gentity_t *ent, vec3_t src, vec3_t vf ) {
continue; continue;
} }
// In case touching button-like entity via use gesture, check activation angle here.
// Existing check in g_trigger.cpp Touch_Multi is problematic because we do not have
// there information by which hand was entity triggered.
if ( DotProduct( hit->movedir, vf ) < 0.5 ) {
//Not Within 45 degrees
continue;
}
touched[i] = qtrue; touched[i] = qtrue;
memset( &trace, 0, sizeof(trace) ); memset( &trace, 0, sizeof(trace) );
if ( hit->e_TouchFunc != touchF_NULL ) { if ( hit->e_TouchFunc != touchF_NULL ) {