Beispiel #1
0
 public ObjectProps(string name, Vector3 pos, Vector3 rotation, Vector3 scale)
 {
     this.name     = name;
     this.postion  = new Vector3Value(pos);
     this.rotation = new Vector3Value(rotation);
     this.scale    = new Vector3Value(scale);
 }
Beispiel #2
0
 static Vector3Value PlayerPositionObjCache = null; // object cache
 public static Vector3Value PlayerPositionAsset()
 {
     if (PlayerPositionObjCache == null)
     {
         PlayerPositionObjCache = Resources.Load <Vector3Value>("PlayerPosition");
     }
     return(PlayerPositionObjCache);
 }                                       // end method PlayerPositionAsset
 public TransformValue(Transform t)
 {
     if (t == null)
     {
         return;
     }
     this.name          = t.name;
     this.localPosition = new Vector3Value(t.localPosition);
     this.roration      = new Vector3Value(t.eulerAngles);
     this.scale         = new Vector3Value(t.localScale);
 }
Beispiel #4
0
        string GetFeatureValue(InputDevice device, InputFeatureUsage featureUsage)
        {
            switch (featureUsage.type.ToString())
            {
            case "System.Boolean":
                bool boolValue;
                if (device.TryGetFeatureValue(featureUsage.As <bool>(), out boolValue))
                {
                    return(boolValue.ToString());
                }
                break;

            case "System.UInt32":
                uint uintValue;
                if (device.TryGetFeatureValue(featureUsage.As <uint>(), out uintValue))
                {
                    return(uintValue.ToString());
                }
                break;

            case "System.Single":
                float floatValue;
                if (device.TryGetFeatureValue(featureUsage.As <float>(), out floatValue))
                {
                    return(floatValue.ToString());
                }
                break;

            case "UnityEngine.Vector2":
                Vector2 Vector2Value;
                if (device.TryGetFeatureValue(featureUsage.As <Vector2>(), out Vector2Value))
                {
                    return(Vector2Value.ToString());
                }
                break;

            case "UnityEngine.Vector3":
                Vector3 Vector3Value;
                if (device.TryGetFeatureValue(featureUsage.As <Vector3>(), out Vector3Value))
                {
                    return(Vector3Value.ToString());
                }
                break;

            case "UnityEngine.Quaternion":
                Quaternion QuaternionValue;
                if (device.TryGetFeatureValue(featureUsage.As <Quaternion>(), out QuaternionValue))
                {
                    return(QuaternionValue.ToString());
                }
                break;

            case "UnityEngine.XR.Hand":
                Hand HandValue;
                if (device.TryGetFeatureValue(featureUsage.As <Hand>(), out HandValue))
                {
                    return(HandValue.ToString());
                }
                break;

            case "UnityEngine.XR.Bone":
                Bone BoneValue;
                if (device.TryGetFeatureValue(featureUsage.As <Bone>(), out BoneValue))
                {
                    return(BoneValue.ToString());
                }
                break;

            case "UnityEngine.XR.Eyes":
                Eyes EyesValue;
                if (device.TryGetFeatureValue(featureUsage.As <Eyes>(), out EyesValue))
                {
                    return(EyesValue.ToString());
                }
                break;
            }

            return("");
        }
Beispiel #5
0
 private void Init(Vector3Value groundClick)
 {
     groundClick.OnChange += OnChangeValue;
 }
	public ObjectProps(string name , Vector3 pos , Vector3 rotation , Vector3 scale ) {
		this.name = name;
		this.postion = new Vector3Value(pos);
		this.rotation = new Vector3Value(rotation);
		this.scale = new Vector3Value(scale);
	}
        string GetFeatureValue(InputDevice device, InputFeatureUsage featureUsage)
        {
            switch (featureUsage.type.ToString())
            {
            case "System.Boolean":
                bool boolValue;
                if (device.TryGetFeatureValue(featureUsage.As <bool>(), out boolValue))
                {
                    return(boolValue.ToString());
                }
                break;

            case "System.UInt32":
                uint uintValue;
                if (device.TryGetFeatureValue(featureUsage.As <uint>(), out uintValue))
                {
                    return(uintValue.ToString());
                }
                break;

            case "System.Single":
                float floatValue;
                if (device.TryGetFeatureValue(featureUsage.As <float>(), out floatValue))
                {
                    return(floatValue.ToString());
                }
                break;

            case "UnityEngine.Vector2":
                Vector2 Vector2Value;
                if (device.TryGetFeatureValue(featureUsage.As <Vector2>(), out Vector2Value))
                {
                    return(Vector2Value.ToString());
                }
                break;

            case "UnityEngine.Vector3":
                Vector3 Vector3Value;
                if (device.TryGetFeatureValue(featureUsage.As <Vector3>(), out Vector3Value))
                {
                    return(Vector3Value.ToString());
                }
                break;

            case "UnityEngine.Quaternion":
                Quaternion QuaternionValue;
                if (device.TryGetFeatureValue(featureUsage.As <Quaternion>(), out QuaternionValue))
                {
                    return(QuaternionValue.ToString());
                }
                break;

            case "UnityEngine.XR.Hand":
                Hand HandValue;
                if (device.TryGetFeatureValue(featureUsage.As <Hand>(), out HandValue))
                {
                    return(HandValue.ToString());
                }
                break;

            case "UnityEngine.XR.Bone":
                Bone BoneValue;
                if (device.TryGetFeatureValue(featureUsage.As <Bone>(), out BoneValue))
                {
                    Vector3    bonePosition;
                    Quaternion boneRotation;
                    if (BoneValue.TryGetPosition(out bonePosition) && BoneValue.TryGetRotation(out boneRotation))
                    {
                        return(string.Format("{0}, {1}", bonePosition.ToString(), boneRotation.ToString()));
                    }
                }
                break;

            case "UnityEngine.XR.Eyes":
                Eyes EyesValue;
                if (device.TryGetFeatureValue(featureUsage.As <Eyes>(), out EyesValue))
                {
                    Vector3 fixation, left, right;
                    float   leftOpen, rightOpen;
                    if (EyesValue.TryGetFixationPoint(out fixation) &&
                        EyesValue.TryGetLeftEyePosition(out left) &&
                        EyesValue.TryGetRightEyePosition(out right) &&
                        EyesValue.TryGetLeftEyeOpenAmount(out leftOpen) &&
                        EyesValue.TryGetRightEyeOpenAmount(out rightOpen))
                    {
                        return(string.Format("{0}, {1}, {2}, {3}, {4}", fixation.ToString(), left.ToString(), right.ToString(), leftOpen, rightOpen));
                    }
                }
                break;
            }

            return("");
        }