浏览代码
Merge pull request #18 from unity/add-human-skeleton-scale-estimation
Merge pull request #18 from unity/add-human-skeleton-scale-estimation
Add human skeleton scale estimation/3.1
GitHub Enterprise
5 年前
当前提交
602b4248
共有 6 个文件被更改,包括 291 次插入 和 13 次删除
-
202Assets/Scenes/HumanSegmentation/HumanBodyTracking3D.unity
-
14Packages/manifest.json
-
12ProjectSettings/ProjectSettings.asset
-
4ProjectSettings/ProjectVersion.txt
-
61Assets/Scripts/TestBodyAnchorScale.cs
-
11Assets/Scripts/TestBodyAnchorScale.cs.meta
|
|||
m_EditorVersion: 2019.1.5f1 |
|||
m_EditorVersionWithRevision: 2019.1.5f1 (0ca0f5646614) |
|||
m_EditorVersion: 2019.2.2f1 |
|||
m_EditorVersionWithRevision: 2019.2.2f1 (ab112815d860) |
|
|||
using System; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
using UnityEngine.XR.ARFoundation; |
|||
|
|||
public class TestBodyAnchorScale : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
[Tooltip("The ARHumanBodyManager which will produce frame events.")] |
|||
ARHumanBodyManager m_HumanBodyManager; |
|||
|
|||
/// <summary>
|
|||
/// Get or set the <c>ARHumanBodyManager</c>.
|
|||
/// </summary>
|
|||
public ARHumanBodyManager humanBodyManager |
|||
{ |
|||
get { return m_HumanBodyManager; } |
|||
set { m_HumanBodyManager = value; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
Text m_ImageInfo; |
|||
|
|||
/// <summary>
|
|||
/// The UI Text used to display information about the image on screen.
|
|||
/// </summary>
|
|||
public Text imageInfo |
|||
{ |
|||
get { return m_ImageInfo; } |
|||
set { m_ImageInfo = value; } |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
Debug.Assert(m_ImageInfo != null, "text field is required"); |
|||
m_ImageInfo.enabled = true; |
|||
|
|||
Debug.Assert(m_HumanBodyManager != null, "Human body manager is required."); |
|||
m_HumanBodyManager.humanBodiesChanged += OnHumanBodiesChanged; |
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
Debug.Assert(m_ImageInfo != null, "text field is required"); |
|||
m_ImageInfo.enabled = false; |
|||
|
|||
Debug.Assert(m_HumanBodyManager != null, "Human body manager is required."); |
|||
m_HumanBodyManager.humanBodiesChanged -= OnHumanBodiesChanged; |
|||
} |
|||
|
|||
void OnHumanBodiesChanged(ARHumanBodiesChangedEventArgs eventArgs) |
|||
{ |
|||
// Currently, the ARKit provider only ever produces one body anchor, so just reference the first
|
|||
float scale = ((eventArgs.added.Count > 0) ? eventArgs.added[0].estimatedHeightScaleFactor |
|||
: ((eventArgs.updated.Count > 0) ? eventArgs.updated[0].estimatedHeightScaleFactor |
|||
: Single.NaN)); |
|||
|
|||
Debug.Assert(m_ImageInfo != null, "text field is required"); |
|||
m_ImageInfo.text = scale.ToString("F10"); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f7a99cf97577b431494054a0b0e5f423 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue