arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

ARFoundation HumanBodyTracker eventArgs.removed never called

Open LangTroyan opened this issue 7 years ago • 9 comments

Greetings,

I'm trying to set some events when a body gets tracked or removed, playing with the method OnHumanBodiesChanged(ARHumanBodiesChangedEventArgs eventArgs) of the HumanBodyTracker script, but when the camera detects a body to track and instantiates the prefab I specified (as expected), it doesn't destroy said object when the person gets out of the camera vision. Instead it just stays floating in the scene until somebody else walks in again. I'd need it to instantiate it and destroy it when somebody walks in and out, but don't know why the .removed event never gets called. On the sample scene HumanBodyTracking3D it seems like the eventArgs never gets to the .removed state neither.

Does it need an extra configuration in order to work as I'd expect?

I've seen there's a ARHumanBody script with the Destroy On Removal parameter, but it doesn't seem to do anything.

Screenshot 2019-10-09 at 20 30 19

I really appreciate the feedback, thanks.

LangTroyan avatar Oct 09 '19 18:10 LangTroyan

In my experience, ARKit is quite reluctant to remove detected trackables (e.g., images), even if they are no longer visible. What is the value of ARHumanBody.trackingState when the person is no longer visible?

tdmowrer avatar Oct 09 '19 18:10 tdmowrer

In my experience, ARKit is quite reluctant to remove detected trackables (e.g., images), even if they are no longer visible. What is the value of ARHumanBody.trackingState when the person is no longer visible?

The ARHumanBody.trackingState is always "Tracking"

LangTroyan avatar Oct 09 '19 18:10 LangTroyan

The ARHumanBody.trackingState is always "Tracking"

Alright, that sounds like a bug, then. I'll fix this for the next release.

tdmowrer avatar Oct 09 '19 20:10 tdmowrer

Fixed in 3.0.0-preview.4

tdmowrer avatar Oct 23 '19 17:10 tdmowrer

Fixed in 3.0.0-preview.4 unity2018.4 ARFoundation 1.5.0-preview fixed ?

littleqiang-go avatar Dec 10 '19 00:12 littleqiang-go

This bug still exists in 4.1.0-preview.7. Why is that? Doesn't seem to get to eventsArg.removed part.

Hypnotistas avatar Sep 21 '20 13:09 Hypnotistas

The bug was that the tracking state was not updated correctly (which has been fixed). The behavior of eventArgs.removed is as-designed.

tdmowrer avatar Sep 21 '20 16:09 tdmowrer

The bug was that the tracking state was not updated correctly (which has been fixed). The behavior of eventArgs.removed is as-designed.

As I wrote - the issue is still there, it doesn't get to "eventArgs.removed" part - if the body tracking is lost, the augmentation starts floating around it is not destroyed. Based on what was written above, tracking state has some correlation to "eventArgs.removed", correct?

So if everything works, how should the body tracking "lost" event should be accessed?

Another bug - you can't instantiate properly different outfits on runtime, it just doesn't work, I assume that's related to the same eventArgs.removed event. If the added robot prefab is not destroyed, then if we assign another outfit prefab on runtime - it is just not instantiated.

Hypnotistas avatar Sep 21 '20 19:09 Hypnotistas

Based on what was written above, tracking state has some correlation to "eventArgs.removed", correct?

No, they are separate concepts. "Removed" means ARKit has told us the anchor is gone forever. However, if it simply cannot see the human anymore, the tracking state likely will change from TrackingState.Tracking to Limited or None.

Another bug - you can't instantiate properly different outfits on runtime...

Please open a new issue for your new question, as this issue was a bug report which has been fixed and the issue is considered closed.

tdmowrer avatar Sep 21 '20 19:09 tdmowrer