Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.03k stars 1.13k forks source link

Issue with multiple character/robot augmentation while using Human Body Tracking #608

Closed Hypnotistas closed 3 years ago

Hypnotistas commented 3 years ago

Hello,

I'm not sure whether that's a bug (maybe!?), but it might be that this requires some simple explanation. What I have in mind specifically HumanBodyTracking3D scene and the build works just fine as far as we go with one "ControlledRobot" augmentation on top of a tracked human body.

So, the more interesting question is: How to make multiple option selection for "ControlledRobot" augmentation? Let's say we have changed material and created new prefabs "RedControlledRobot" and "GreenControlledRobot". Now the augmentation part itself takes place in "HumanBodyTracker.cs" script attached on "Human Body Tracking" gameObject where we can assign these prefabs to "skeletonPrefab" gameObject variable.

What I have tried so far is duplicated "Human Body Tracking" gameObject (have 2 in the scene) and assigned "RedControlledRobot" to one of them and "GreenControlledRobot" prefab to the second one.

Logically thinking, if we want to augment only RedControlledRobot, then we should enable first "Human Body Tracking" gameObject and disable the second "Human Body Tracking" gameObject where "GreenControlledRobot" is assigned. Once app is launched and pointed to a human body augmentation of RedControlledRobot takes place, but if we disable first "Human Body Tracking" gameObject and enable the second "Human Body Tracking" gameObject (using button) - in theory "GreenControlledRobot" augmentation should take place - but it's not, the robot appears but it does not follow user movement, so something is wrong here.

However, if at the beginning both of "Human Body Tracking" gameObjects are enabled - both, Red and Green ControllerRobot augmentation takes place well and follows user movements, but we don't want to do both augmentation at the same time.

I have tried so many other things and nothing didn't worked, the above described approach was only one of many.

So the question is: how should we properly switch between different character/robot augmentations?

Thank you for the help in advance!

tdmowrer commented 3 years ago

ARFoundation supplies you with the bone data, but how you apply it is up to you. A good starting point would be to look at how the HumanBodyTracker sample code initializes and a new detected body. When you switch between your red and green robots, you can use similar logic.

Hypnotistas commented 3 years ago

ARFoundation supplies you with the bone data, but how you apply it is up to you. A good starting point would be to look at how the HumanBodyTracker sample code initializes and a new detected body. When you switch between your red and green robots, you can use similar logic.

It's clear what HumanBodyTracker.cs does, but it's not working as expected when we talk about multiple outfits/robots. What should be the exact approach to switch between two different robots? It doesn't seem to allow you re-initialize bone information on your second robot properly if we decide to switch it.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hypnotistas commented 3 years ago

The issue still exists...

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hypnotistas commented 3 years ago

Maybe I will formulate a question in a different way. What is the best approach to make multiple outfit augmentation (by selection)?

mdurand42 commented 3 years ago

Maybe I will formulate a question in a different way. What is the best approach to make multiple outfit augmentation (by selection)?

  • Should we have multiple HumanBodyTrackers or only one?
  • If only 1 - How should the outfit switching should take place? It doesn't seem that it would re-initialize SkeletonPrefab (used for robot augmentation) generation once it's done for the first time so that we could assign our own model.
  • Should we maybe just have a robot augmented with turned off mesh and copy the bones/joints of a robot and pass it to our own outfit bones/joints?

@Hypnotistas The sample that we provide works for the case of a single tracked human and this scenario matches what is currently possible with AR Foundation/ARKit. So it would be best to engage the community via the forums for advice on how to adapt the functionality we support for your use case (which is outside our current scope).