I am fairly new to scripting in Unity and need some direction on how to apply a touch event to a Game Object to trigger an animation.
I'm currenly using javascript to initiate an animation "onMouseDown" when the game object is clicked (this works great). I have an if/else statement that toggles between my "open" and "close" animations.
How would I rewrite the below javascript logic in C#? Is it required to utilize the "IVirtualButtonEventHandler" to initiate an animation on touch event?
var doorObj:GameObject;var isOpen = false;function OnMouseDown(){ Debug.Log("mouse is down"); if(!this.isOpen){ doorObj.animation.Play("close"); this.isOpen = true; }else{ doorObj.animation.Play("open"); this.isOpen = false; }}
Trigger Animation with Touch Event.
There is sample code at the beginning of this thread that shows you how to capture touch events - https://ar.qualcomm.at/content/how-add-touch-listener-3d-object-unity
Trigger Animation with Touch Event.
Hello .All links with ar.qualcomm.at are broken can you update the links please. I'm working for a week on something that need touch listener with ARCamera and can't figure out what am I doing wrong.
Trigger Animation with Touch Event.
Thank you, the touch listener works great!