• Happy Holidays Guest!

    We want to announce that we will be working at reduced staffing for the holidays. Specifically Monday the 23rd until Jan 2nd.

    This will affect approval queue times and responses to support tickets. Please adjust your plans accordingly and enjoy yourselves this holiday season!

  • Hi Guest!

    Please be aware that we have released a critical security patch for VaM. We strongly recommend updating to version 1.22.0.7 using the VaM_Updater found in your installation folder.

    Details about the security patch can be found here.
(Extended) VR Controllers

Plugins (Extended) VR Controllers

fabio

Well-known member
Messages
73
Reactions
271
Points
53
fabio submitted a new resource:

(Extended) VR Controllers - Move and rotate objects using thumbstick VR axis control

(Extended) VR Controllers enable movement and rotation of objects using thumbstick VR axis control. It is compatible with both OVR and OpenVR modes, and it should work with any controller like Oculus, Vive, Index, ...

The plugin is activated and deactivated by pressing both Left Trigger + Right Trigger. While active it can move the selected object with the left stick and rotate it with the right stick. When deactivated, the sticks return to their default behavior.

The...

Read more about this resource...
 
@fabio excellent plugin. Thanks for sharing. Had a question, do you know what the value is to get the Trigger instead of the Grab Hold?

Currently the code calls GetLeftGripVal, what would be the equivalent for the other button? Would you know?

Thanks!
 
I just realized the other button is not treated as having a Value that passes a tolerance but is On/Off so it would be a different approach.

What I'm trying to do is to switch the Grab and Trigger since you tend to do a lot of "grabbing" in VR with both hands which enables the movement and sometimes it's not what you want but its much rarer that you click both Triggers at the same time.
 
Yes, doing the same with the other button would be more complicated, it only turns ON for 1 single frame when you press it. Synchronizing both in a single frame, well... it would be hard.

I have half finished the next version with local coordinates and stuff, in there you can to deactivate the plugin using both buttons from 1 single controller. Maybe this will help? I'm working on something else right now but it should take me a couple of weeks to publish the update.
 
I tested it with the Grab button without a tolerance. It is indeed tricky but will work for now as it stops me accidentally activating it.

Great stuff for the revision; Curios of the improvements! Thanks so much for the reply!
 
Cool, so which buttons are you exactly pressing to activate the plugin? I may switch to your choice if that avoid the issue you are describing.
 
Right now I have it set-up like this:

bool a = SuperController.singleton.GetLeftGrab();
bool b = SuperController.singleton.GetRightGrab();
//bool a = SuperController.singleton.GetLeftGrabVal() > tolerance;
//bool b = SuperController.singleton.GetRightGrabVal() > tolerance;

But as you said, its a bit difficult to engage and disengage.

The absolute best would be the Trigger button as ON/OFF and the GRIP button from the other hand with a tolerance. I tested it on the GRIP buttons and it works fine but since I can't map it to the Trigger given that I don't know the call out it doesn't solve the issue.

I also had to add the following two variables in your if (enableChk.val) to retain functionality:

bool c = SuperController.singleton.GetLeftGrabVal() > tolerance;
bool d = SuperController.singleton.GetRightGrabVal() > tolerance;

If ever you figure out what the SuperController callout is for the Left and Right triggers let me know!

Thanks
 
This is what SuperController offers

Trigger buttons : get 'true' every frame while the trigger is being pressed
Code:
bool LT = SuperController.singleton.GetLeftGrabVal() > tolerance;
bool RT = SuperController.singleton.GetRightGrabVal() > tolerance;


Grip buttons : get 'true' only the 1st frame while the grip is being pressed
Code:
bool LB = SuperController.singleton.GetLeftHoldGrab();
bool RB = SuperController.singleton.GetRightHoldGrab();


if LT + RT are problematic, I guess I can do the switch with (LT + LB) or (RT + RB). I mean using the trigger and the grip from the same hand. Not sure if this is going to interfere with something.
 
That's exactly what I needed! Now I activate it either by LT + RB or RT + RL as follows and it doesn't interfere with anything.

Everything I've added or changed is in yellow below.

Thanks a lot for the help!

private void DoStep()
{
bool a = SuperController.singleton.GetLeftGrabVal() > tolerance;
bool b = SuperController.singleton.GetRightHoldGrab();
bool c = SuperController.singleton.GetRightGrabVal() > tolerance;
bool d = SuperController.singleton.GetLeftHoldGrab();


if (a & b || c & d)
{
if (changing == false)
{
changing = true;
enabledChk.val = !enabledChk.val;
}

return;
}

changing = false;

if (enabledChk.val)
{
Vector4 axes = SuperController.singleton.GetFreeNavigateVector(SuperController.singleton.freeMoveAction);
pressing = a || c;

if (pressing)
{
if (Math.Abs(axes.y) > tolerance) { ControllerMove(3, axes.y); }
if (Math.Abs(axes.z) > tolerancer)
{
ControllerRotate(3, -axes.z, 1);
return;
}
}
else
{
if (Math.Abs(axes.x) > tolerance) { ControllerMove(1, axes.x); }
if (Math.Abs(axes.y) > tolerance) { ControllerMove(2, axes.y); }
if (Math.Abs(axes.z) > tolerancer)
{
ControllerRotate(2, -axes.z, 1);
return;
}
if (Math.Abs(axes.w) > tolerancer)
{
ControllerRotate(1, -axes.w, 1);
return;
}
}
}
}
 
fabio updated (Extended) VR Controllers with a new update entry:

(Extended) VR Controllers 2

If you don't tweak anything you still have v1.0 . But here's the new stuff

  • Updated the buttons to activate / deactivate the plugin. Use Trigger + Grab from any hand.
  • Possibility to choose between relative and local coordinates.
  • Customize stick movement and rotation speeds.
  • Control a different object with each stick.
  • Map an object to the left or right controller, then switch between movement and rotation by pressing the Grab button.
  • Disable person 'root' movement is...

Read the rest of this update entry...
 
Hey,

I had another question, would you happen to know what the code would be for the A and X buttons on the Oculus controllers? I'm trying to map a toggle for switching between Play Mode and Edit Mode without going through the menu each time using the following functions:

SuperController.singleton.gameMode = SuperController.GameMode.Play;
SuperController.singleton.gameMode = SuperController.GameMode.Edit;

It would be using the same philosophy as above with holding down either of the triggers and pressing A for Play and X for Edit.


private void DoStep()
{
bool a = SuperController.singleton.GetLeftGrabVal() > tolerance;
bool b = SuperController.singleton.GetLeft"????"(); // this would be the X button

bool c = SuperController.singleton.GetRightGrabVal() > tolerance;
bool d = SuperController.singleton.GetRight"????"(); // this would be the A button

if (a & b) SuperController.singleton.gameMode = SuperController.GameMode.Play;

if (c & d) SuperController.singleton.gameMode = SuperController.GameMode.Edit;


...

Many thanks,
 
That's a very good idea! I might implement it in a slightly different way. I could add a checkbox that optionally enables Edit mode when showing the menu and automatically switching to Play mode when hiding it.

Here's the code, you're going to have to implement some kind of logic since the controller Y and B buttons return true as long as you hold down these buttons.

Code:
        bool Y = SuperController.singleton.GetMenuMoveLeft();  // Y: left show/hide menu    - return TRUE while the button is being pressed
        bool B = SuperController.singleton.GetMenuMoveRight(); // B: right show/hide menu    - return TRUE while the button is being pressed

        bool X = SuperController.singleton.GetLeftSelect();   // X: left select                - return TRUE on first frame only
        bool A = SuperController.singleton.GetRightSelect();  // A: right select            - return TRUE on first frame only
 
Back
Top Bottom