The moving average (filter) of the acquired value of the HTC vive controller
I am a beginner for Unity. Currently, I acquired "Position" and "Rotation" of HTC vive controller, I'm trying to move an object by reflecting it in the acquired value. However, I trying to use filter and moving average for the purpose of stabilizing value to be acquired, but I can not write the program well.
If you have time, I'd really appreciate it if you could give me your opinion.
Best Regards
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Larm_control : MonoBehaviour {
public GameObject Con;
void Start()
{
StartCoroutine(loop());
}
void Example()
{
Con = GameObject.Find("Larm_Hand");
}
IEnumerator loop()
{
while (true) {
yield return new WaitForSeconds (0f);
float px = Con.transform.position.x;
float py = Con.transform.position.y;
float pz = Con.transform.position.z;
float rx = Con.transform.eulerAngles.x;
float ry = Con.transform.eulerAngles.y;
float rz = Con.transform.eulerAngles.z;
this.transform.position = new Vector3 (px, py, pz);
this.transform.eulerAngles = new Vector3 (rx, ry, rz);
}
}
}
Reference URL: https://www.gamasutra.com/blogs/CharlieDeck/20161118/285808/Why_Throwing_in_VR_Sucksand_How_to_Make_it_Better.php http://edom18.hateblo.jp/entry/2017/02/19/124337
Your answer
Follow this Question
Related Questions
How to get type double to vector3? 0 Answers
Double vs Float 1 Answer
I HAVE TWO ERROR ONE IN StartCoroutine(SpawnBigTree()); AND ONE ON FLOAT 0 Answers
Check rotation for a Rigidbody2D 0 Answers