HTC vive, No javascript clickDownOnEntity action?


#1

I just tried to open the door with my HTC vive.
It’s impossible, is clickDownOnEntity not working with the vive,
or is something not implemented.

Worse, scripters need to program for both in different ways.
I expetc that clickDownOnEntity need to work with HTC vive too, but it’s not for me.


#2

Click down entity is only for mouse, it behaves differently for controllers, use Triggers instead like in the fireworks script.
https://readme.highfidelity.com/docs/fireworks-scripting-tutorial#section-chapter-2-launching-a-firework-on-mouse-click-or-hand-controller-trigger-

This is because,. unlike the mouse, all the interaction actions with hand controllers are controller via handControllerGrab.js, where as mouse interactions are controllers in the actual native code.


#3

Ok, thanks. more homework needed for my door. It now only works with mouse.


#4

I tried to gte it working, but the docs is fuzzy. exampel scripts are fuzzy to. Something with prototyping crap i do not need.

I just need a function that get triggered when you click a botton on the HTC vive. and give the button number back as example. if it;'s touched or not.

But really there;s no simpe basic example that explaines functionality like that. Big examples are bad. tiny simple ones are better on docs pages, you can combine it later.

SO for now, i gave up on making my door work with the vive. Lack of readable documentation.

Would be b etter if mouseclick working on the vive to ! So objects made for desktop works simple in the vive.

SImple example for handcontrollers to click interact with objects is still welcome !


#5

Here is a very, very simple one, thats based on the fireworks one, thats also -very- simple.

(function() {
 ControllerInteractable = function(){
	// Initiate object
 };
 
 // Define prototype class
  ControllerInteractable.prototype = {
    startNearTrigger: function() {
      print("Controller Triggered near");
    },

    startFarTrigger: function() {
      print("Controller Triggered far");
    },

    clickReleaseOnEntity: function() {
      print("Click");
    }
  };  
  return new ControllerInteractable();
});  

The reason why these are done through prototype is because the controller script interacts with these, specifically startNearTrigger and startFarTrigger.
v
For the door, you may want to use startNearTrigger for opening the door.


Is there a VR version of the mouse event clickDownOnEntity?
#6

I did put the above script on my local disk, and add the path inside entity. so far i have no luck to get it working. When i click the entity i do not get any chat response back. I just did add a print line in the init object, that gives feedback so the script must work. But no response back from the vive.

Note: There for me more problems with clicking and sitting.
Same with fireworks on playa. one button works. other not.
Last week on other domain some object failed also to trigger.

Mabye time for clean interface installation ?!

Add: New reinstall of the high fidelity code (no ini changes, did reset that before already) i still have no response on soem entities in high fideity. bug ?


#7

try return new ControllerInteractable();


#8

EDIT: Oh wow, it works at least with the mouse now. going to test the controller.

— old post –

@thoys It’s still not working. unless i do something wrong. i have now this script. i see once the init and something text. and that’s it.

(function() 
{

    ControllerInteractable = function()
    {
    // Initiate object
    print("Init");
    };
 
    // Define prototype class
    ControllerInteractable.prototype = 
    {
        startNearTrigger: function() {
      print("Controller Triggered near");
    },

    startFarTrigger: function() 
    {
      print("Controller Triggered far");
    },

    clickReleaseOnEntity: function() 
    {
      print("Click");
    }
  };  
  
  print("Something");
  return new ControllerInteractable();
});

#9

This is what I get for just writing something by guesswork :smiley:


#10

@menithal, i checked the log. and i see grab.js and handcontrollergrab.js are loaded many times. So that cannot be the problem.

Still at square one with the vive hand controller.


#11

I don’t think those events are supposed to work unless you set the correct userData.


#12

I go look at it when am really finished with the mini golf. I need to look at other scripts.

If you need userdata, it’s not on the docs page i think.


#13

Found the problem, seems to work now with the above script.
You need to activate “Triggerable” in the entity properties to.


#14

Just a comment to myself i guess. i start to studie javascript again with the vive handcontroller. after reading soem javascript. it’s mabye not optimized but more readable to write for now the code this way.

(function() 
{

    ControllerInteractable = function()
    {
        // Initiate object
        print("Init");
    };
 
    ControllerInteractable.prototype.startNearTrigger = function() 
    {
        print("Controller Triggered near");
    };

    ControllerInteractable.prototype.startFarTrigger = function() 
    {
        print("Controller Triggered far");
    };

    ControllerInteractable.prototype.clickReleaseOnEntity = function() 
    {
        print("Click");
    };
  
  print("Something");
  return new ControllerInteractable();
});

But it’s now to late to test if the handcontroller functions are working to, the previous way of writing create a complex readable code. I hope this work. at least it works with the mouse.

Updated the script, i posted above, this way is working to. The way james is doing it works also. But i find my way much more readable, and better to follow.