Jump to content

VR trigger affecting gui


photo

Recommended Posts

Hello

For some reason vive controller trigger button affect gui mouse

object_gui.setMouseMode(ObjectGui.MOUSE_VIRTUAL);// init
...
object_gui.setMouse(p0, p1, buttonPressed, showMouseCursor);// update

at half press it try to move window

at full press it hide window

I don't write this, and don't want it and can't find how to change it

so intension to click on any button turns in total disaster

how to workaround this behavior?

Edited by lightmap
Link to comment

Hi Lightmap,

I'm afraid i don't understand you. I need more information about it. Is it based on VR Template? What is the "buttonPressed" variable and where and how do you set it? Can you give to us a small sample?

Best regards,
Alexander

Link to comment

Hi

It is not based on VR Template, it on sdk 2.7.2 with c# wrapper + AppVive dll

buttonPressed comes from vive trigger state; buttonPressed = hit_gui * (Vive.trigger()>0.5f?1:0)

As I suppose, somewhere in Engine code, if Vive connected, happens controller logic that move window at mid trigger state - is that true?

Edited by lightmap
Link to comment

Hi,

As I suppose, somewhere in Engine code, if Vive connected, happens controller logic that move window at mid trigger state - is that true?
Engine doesn't know about Vive because it is an extern plugin "AppVive". This is not an engine code.
In your code:

buttonPressed = hit_gui * (Vive.trigger()>0.5f?1:0); // if trigger position more than 50% then buttonPressed == 1
object_gui.setMouse(p0, p1, buttonPressed, showMouseCursor); // use gui at vive controller position (click, hold, drag...)

you can see that window starts moving when "trigger > 0.5f" (half press of the trigger). If you don't want it - just remove the "Vive.trigger() > 0.5f" condition.

By the way, what type of behavior do you expect? If you don't want to move a specific window use WidgetWindow::setMoveable(0) method.

Best regards,
Alexander

  • Like 1
Link to comment

ok, simple check Vive.Trigger(){return 0;} shows that something wrong in our code

the problem when I press trigger at 1.0f - gui mouse disappears, and I can't find where it is

public void OnUpdate(){
	int hit_gui = 0;

        // update visuals
        vec3 p0 = param().start.ToVec3();
        vec3 p1 = param().end.ToVec3();
        WorldIntersection intersection = new WorldIntersection();
        Unigine.Object hitObj = World.get().getIntersection(p0, p1, 1, intersection);
        if (hitObj != null)
        {
            hit_gui = 1;
        }
        var press = param().exec;// < (Vive.trigger()>0.5f?1:0);
        var buttonPressed = hit_gui * press;

        object_gui.setMouse(p0, p1, buttonPressed, hit_gui);
}

thanks

Link to comment

Thanks, found problem, it's gui intersection with skinned hand

also, how to setup intersection mask for object_gui?

object_gui.setCollisionMask(64, 0);// init
Unigine.Object hitObj = World.get().getIntersection(p0, p1, 64, intersection);// update

and how to draw vr gui always on top of scene objects?

object_gui.getGui().addChild(imageItem, Gui.ALIGN_OVERLAP | Gui.ALIGN_CENTER);

 

Link to comment

Hi,

How to setup intersection mask for object_gui?
You should use setIntersectionMask() instead of collision mask.

How to draw vr gui always on top of scene objects?
Just disable "Depth Test" in your ObjectGui material.
 

Best regards,
Alexander

disable_depth_test.png

  • Like 1
Link to comment
×
×
  • Create New...