Multiple collision objects on a single game object

Hello again!
I have a setup that may be outside the limitations of what the game engine can muster, but haven’t found direct information about it, so here I am!
I have an enemy game object that I want to react differently to the player at different ranges. The setup I’d like to use is to represent those ranges with their own collision shapes to provide individual trigger_response cues, but I don’t know if there’s a way to actually differentiate the messages.
I tried giving each collision shape its own group(ensuring the groups were also listed in the player’s collision object’s mask), but every trigger_response message.own_group info came back as the generic ‘enemy’ group that I used for the main kinematic collision box, so I’m wondering if what I’m trying for is even possible.

The other setup I’m considering is just to have the largest collision trigger range, and have the enemy measure the distance from the player to determine behaviour, but I was hoping to avoid as many update calls as possible.

If it’s just a matter of distance checking rather than complex convex polygon intersection, I would use a circular shape as a preliminary collision filter. When a collision is triggered, I would then calculate the distance between the two points. With this value, you can apply your own distance criteria to determine different logic outcomes.

If you want to avoid polling for something so simple, I’m guessing your intention is to have lots of entities? You could base your logic on the squared length to the player and avoid the square root.

local b_minus_a = player_pos - enemy_pos
local length2 = vmath.dot(b_minus_a, b_minus_a)

You can do it with different groups for different collision objects but you have to check message.other_group.

Ex.
The player could have two collision objects. One with group “player_near” and the other with group “player_far”. Both of them would have mask “enemy”.
The enemy could have a collision object with group “enemy” and mask “player_near, player_far”.

In the enemy script, in case of a collision/trigger message you can check message.other_group and compare it with hash(“player_near”) and hash(“player_far”) to decide what should the enemy do.