Unity-Technologies / arfoundation-samples

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

how to move and rotate the robot from HumanBodyTracking3D? [how to] #547

Closed joexusun closed 3 years ago

joexusun commented 4 years ago

I'm trying to place the robot from "human body tracking 3d" (Unity-Technologies/arfoundation-samples/blob/latest-preview/Assets/Scenes/HumanTracking/HumanBodyTracking3D.unity) into my game. The idea is that the player can use their body to control the robot (similar to kinect games). I think the "human body tracking" is the gameobject that I should manipulate. I tried transforming it, it does not move.. How can I transform the robot? I need it to move and rotate.

joexusun commented 4 years ago

I ended up with transforming all other objects and camera and achieved what I wanted .. but still like to know, is it possible to transform the robot? I also tried make it a prefab and instantiate, but it didn't work either. Is it just different than a normal gameobject?

tdmowrer commented 4 years ago

I tried transforming it, it does not move.. How can I transform the robot? I need it to move and rotate.

What did you do exactly? Can you share some code here?

joexusun commented 4 years ago

At first, I changed the location in GUI. image but that didn't work. then I realized that this is just an gameobject that somehow instantiates the robot.

I think my problem was that when the program runs, the tracked human isn't always in the middle of the frame. I'd like to transform the whole "game world" based on the "game world location" of the newly instantiated robot, so that I can always have the robot at the correct spot in my game.

How do I get the location of the robot? It doesn't look like an instantiated gameobject as what I saw before ..

Thanks.

joexusun commented 4 years ago

I think I still don't quite understand how does this "human body tracker" component work after reading the scripts.. It uses "AR Session Origin" as the human body manager, (with prefab defined in the same script) image

but then in "AR Session Origin"'s "AR Human Body Manager", the "Human Body Prefab" was left blank. When should a prefab be used here? image

tdmowrer commented 4 years ago

I'd like to transform the whole "game world" based on the "game world location"

You can do that be setting the transform of the ARSessionOrigin. It effectively moves the entire AR world.

How do I get the location of the robot?

The human body is a trackable, so you can get it from the ARHumanBodyManager.trackables collection.

stale[bot] commented 4 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.

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.