using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Enflux.SDK.Core;
using UnityEngine.UI;
using System;
using System.Linq;
using Enflux.Common.DataTypes;
using Enflux.SDK.Core.Devices;
using Enflux.SDK.DataTypes;
using Enflux.SDK.Extensions;
using Enflux.SDK.Utils;
using Enflux.Shim.Utils;
using System.IO;
public class example0 : MonoBehaviour
{
// Assign these in the editor.
public EnfluxManager EnfluxManager;
public Humanoid Humanoid;
// Retrieve limb orientations as Unity local space quaternions.
private void GetLocalSpaceOrientations()
{
var chest = Humanoid.LocalOrientations.Chest.Orientation;
var leftUpperArm = Humanoid.LocalOrientations.LeftUpperArm.Orientation;
var leftLowerArm = Humanoid.LocalOrientations.LeftLowerArm.Orientation;
var rightUpperArm = Humanoid.LocalOrientations.RightUpperArm.Orientation;
var rightLowerArm = Humanoid.LocalOrientations.RightLowerArm.Orientation;
var pelvis = Humanoid.LocalOrientations.Pelvis.Orientation;
var leftUpperLeg = Humanoid.LocalOrientations.LeftUpperLeg.Orientation;
var leftLowerLeg = Humanoid.LocalOrientations.LeftLowerLeg.Orientation;
var rightUpperLeg = Humanoid.LocalOrientations.RightUpperLeg.Orientation;
var rightLowerLeg = Humanoid.LocalOrientations.RightLowerLeg.Orientation;
}
// Retrieve limb orientations as real world NED (North-East-Down) space quaternions. private void GetNedSpaceOrientations() { var chest = EnfluxManager.NedOrientations.Chest.Orientation; var leftUpperArm = EnfluxManager.NedOrientations.LeftUpperArm.Orientation; var leftLowerArm = EnfluxManager.NedOrientations.LeftLowerArm.Orientation; var rightUpperArm = EnfluxManager.NedOrientations.RightUpperArm.Orientation; var rightLowerArm = EnfluxManager.NedOrientations.RightLowerArm.Orientation; var pelvis = EnfluxManager.NedOrientations.Pelvis.Orientation; var leftUpperLeg = EnfluxManager.NedOrientations.LeftUpperLeg.Orientation; var leftLowerLeg = EnfluxManager.NedOrientations.LeftLowerLeg.Orientation; var rightUpperLeg = EnfluxManager.NedOrientations.RightUpperLeg.Orientation; var rightLowerLeg = EnfluxManager.NedOrientations.RightLowerLeg.Orientation; Debug.Log("胸 " + chest); Debug.Log("<color=blue>" + "左肘 " + leftUpperArm + "</color>"); Debug.Log("<color=blue>" + "左手首 " + leftLowerArm + "</color>"); Debug.Log("<color=red>" + "右肘 " + rightUpperArm + "</color>"); Debug.Log("<color=red>" + "右手首 " + rightLowerArm + "</color>"); } void Start() { } private float timeleft; int log;
void Update()
{
timeleft -= Time.deltaTime; if (timeleft <= 0.0) { timeleft = 1.0f; log++; Debug.Log("Log : " + log); // textSave(GetNedSpaceOrientations); GetNedSpaceOrientations(); // Debug.Log(GetNedSpaceOrientations()); // this.GetComponent<Text>().text = GetNedSpaceOrientations(); }
}
/* public void logSave(int num, string txt) { StreamWriter sw; FileInfo fi; fi = new FileInfo(Application.dataPath + "/FileName.csv"); sw = fi.AppendText(); sw.WriteLine("test output"); sw.Flush(); sw.Close(); } */ public void textSave(int log) { StreamWriter sw = new StreamWriter("../aaaaa.txt", true); //true=追記 false=上書き sw.WriteLine(log); sw.Flush(); sw.Close(); }
}
unityを使って現在開発中なのですが、GetNedSpaceOrientations()の値を
console上と画面にだしたいのですがエラーになり足止め状態になっています。
また、consoleで出力した内容をテキスト上に書き出したいのですがそれもわからなくて困っています。
Update内の//の部分が主なわからない内容です。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/13 01:11
2017/12/13 01:57
2017/12/13 02:06