How can this be accomplished? There are plenty of examples with mouse clicks or VR draggable but in case of trigger button on quest controller activating some script on object (not UI flat button) pointed by ray, I am lost there. A scene within a samples would be helpful
Original Post on Discord
by user 393555151903916042
What do you mean by activating for example?
It works the same as mouse clicks mainly. See for example the DragControls component - works with touch, mouse, vr and ar using the same code
I see that DragControls.cs is empty, but I’ve found a js and ts files of the same name. Is the cs file just sort of a placeholder and we actually cannot write in c#?
by user 393555151903916042
Thanks, but after 2 hours trying to make a basic unity script in typescript I have realized that it is not for me
by user 393555151903916042
Sorry to hear. May i ask what you were actually trying to do? Im still not sure what you meant by “activating” an object. Maybe its something that can be done using builtin components. E.g. if you just want to run some code on clicking an object (in VR or desktop) you can just add an ObjectRaycaster and a EventTrigger or Button component and use the UnityEvent for OnClick to run a function or play an animation 
My choice of words there was bad - I am building a 3D design portfolio site and I the first thing I wanted to do is point to an object in space, pull trigger on Quest, and that would bring pointed 3D object within a certain distance and orientation (some will be billboard) - thinking script is simpler than Animator since user could move and I didn’t want to animate 50 objects
So a trigger would toggle a state on Component, or run a function to toggle between moving toward user, or back to original position
Discovering how to use TS on the go was hard, like why is there only a getter for .position
(until I found I have to use set
instaed of =
)
I got stuck on the first thing with “SmoothDamp”
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
Took me long a time to find about built-in TWEEN library that seems to have alternative for SmoothDamp, but intelisense in VS was not giving me anything on how to use it
by user 393555151903916042
You can reuse the same Animator on any number of objects actually - what you describe should work pretty much “no-node”, as in, for clicking on something and having an animation play there’s no need to make custom scripts