Is there a VR version of the mouse event clickDownOnEntity?


#1

I would like an object to behave the same when I click on it using my mouse or if I point at it with a laser and “click” in VR. I expected the clickDownOnEntity would work, but it appears to be mouse only? I haven’t found an equivalent callback for VR controls. Is there an established way of doing this or am I missing something?


#2

I suspect this to be “broken”.
I have some “click to teleport” entities on my domain that stopped to works in HDM there is maybe 1 month ago.
It would be logic to say that it certainly uses that same event.
It was working for mouse and controller before.


#3

clickDownOnEntity is mouse specific.

for vr you need to use

startFarTrigger: Distance Trigger press
continueFarTrigger: Distance Trigger hold
stopFarTrigger: Distance Trigger stop

startNearTrigger: Close Trigger press / hand very close to object
continueNearTrigger: Close Trigger hold / hand very close to object
stopNearTrigger: Close Trigger stop / hand very close to object

details here: HTC vive, No javascript clickDownOnEntity action?

You also need to enable triggerable for the entity. which is usedata of {"grabbableKey":{"wantsTrigger": true}}


#4

You can also use mousePressOnEntity. Though last time I tried it not long ago, the event occurred twice per click.


#6

Thanks for the help! It worked almost like a charm (turns out that you can’t have the object being activated be collisionless either).

However, I’ve run into another issue. I have my event hooked up to startFarTrigger but I seem to get it twice with every activation. Is this a bug, or am I expected to manually limit the input using stopFarTrigger?


#7

Yes it’s triggering twice. Any way to fix?


#8

Just tested mousePressOnEntity in current release and it triggers once for mouse, twice for controllers.

The double-clicks can be distinguished because they have different event properties. For example, the first event’s button property has a value of "None" whereas the second event has a value of "Primary".