Opening a door animated in Cinema4D gazing at it with Google VR
Hello, fellow commUnity!
I´m Toño, from Spain. Right now I´m building my first VR demo, just for learning. I´ve been searching profusely but I haven´t been able to find any information about this. Since it´s a kinda basic interaction in VR, this could also be useful for many people in the future.
Well, let´s go:
I have a model of a drawer. I´d like the door to open when I gaze at it using Google VR unity package (Gvreticle). Gazing at other place would make the door to close.
I´ve created the animation in Cinema4d, exported it to FBX, and imported it on Unity.
![alt text][1]
In the animation inspector, I made clips for the "open" and "close" animations. I´ve also made an animation controller with two states transitioning to each other with a bool changing to true or false.
In my cupboard asset, I´ve added an animator component properly configured.
I also made a version of a simple script
using UnityEngine;
using System.Collections;
public class Controlpuerta : MonoBehaviour {
private Animator animator;
void Awake () {
animator = GetComponent <Animator> ();
}
void OnPointerEnter (Collider other) {
{
animator.SetBool ("Abrir", true);
}
}
void OnPointerExit (Collider other) {
{
animator.SetBool ("Abrir", false);
}
}
}
Abrir means "Open" and Controlpuerta "Doorcontrol". (Yes, I´m spanish)
(original code for comparison here at 18:51) https://www.youtube.com/watch?v=jWuNtik0C8E).
When I play my scene, the door opens itself. Also, the reticle doesn´t react to the object unless I add an event trigger component to it.
Thank you very much in advance just for reading this. If you even answer, you´d be making an avid VR rookie very happy! [1]: /storage/temp/72303-2016-06-16-22-28-12-unity-personal-64bit-mesa-pare.png
Your answer
![](https://koobas.hobune.stream/wayback/20220612083105im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Jump problem animation 0 Answers
Cross-Platform Input 3 Answers
XboxCtrlrInput Dead Zone 0 Answers
Is there anyhow to know if the axe is positive or negation 0 Answers
Input.GetAxis() wrong values on laptops 0 Answers