Jump to content

[lua] missing bindings for VR


AnthonyPython
 Share

Go to solution Solved by AnthonyPython,

Recommended Posts

Overload Entity::Attach(VrDevice) does not exist in lua

we can HMD::SetOffset in lua but not HMD::GetOffset of the HMD( checked and it looks like Getting the offset isn't in C++ either)

VR Controllers right and left stick axis is missing entirely

 

OS: Windows 10 Pro

CPU:  i3-10100 CPU @ 3.60GHz
GPU: NVIDIA 2060 Super - 8 GB

RAM: 32 GB

Link to comment
Share on other sites

On 10/2/2024 at 12:09 PM, AnthonyPython said:

Overload Entity::Attach(VrDevice) does not exist in lua

Fixed for the next build.

On 10/2/2024 at 12:09 PM, AnthonyPython said:

we can HMD::SetOffset in lua but not HMD::GetOffset of the HMD( checked and it looks like Getting the offset isn't in C++ either)

There is currently no HMD::GetOffset command. I am not sure how it would work because SetOffset accepts a position and a rotation.

On 10/2/2024 at 12:09 PM, AnthonyPython said:

VR Controllers right and left stick axis is missing entirely

I don't understand this? :blink:

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

3 hours ago, Josh said:

Fixed for the next build.

There is currently no HMD::GetOffset command. I am not sure how it would work because SetOffset accepts a position and a rotation.

I don't understand this? :blink:

there is no way to get the analogue sticks on VR controllers just trigger and touchpad through the VR stuff, they are only available for the normal gamepad stuff, at least that's what I see with the enum for them.

Screenshot 2024-10-04 181520.png

OS: Windows 10 Pro

CPU:  i3-10100 CPU @ 3.60GHz
GPU: NVIDIA 2060 Super - 8 GB

RAM: 32 GB

Link to comment
Share on other sites

18 minutes ago, Josh said:

I thought the touchpad axis was the same thing as the analog stick on the knuckles controllers...

it seems to not be, they appear to be independent at least from my own testing I've only been able to use the actual touchpad stuff

 

if rightController then
        local axisRight = rightController:GetAxis(1) 

        if (Abs(axisRight.x) > tol or Abs(axisRight.y) > tol) then
            local newposition = Vec3(self.targetEntity:GetPosition(true).x + axisRight.x,self.targetEntity:GetPosition(true).y,self.targetEntity:GetPosition(true).z)
            self.targetEntity:SetPosition(newposition,true)
            Print("right X: " .. axisRight.x .. "right y" ..axisRight.y)
        end
       
end

and this only works on the touchpad from when I tried

OS: Windows 10 Pro

CPU:  i3-10100 CPU @ 3.60GHz
GPU: NVIDIA 2060 Super - 8 GB

RAM: 32 GB

Link to comment
Share on other sites

I just tried a Valve knuckle controller with this code, and it showed the same axis for the analog stick and the little toucharea next to it:

Note that the constants in Lua are equal to the C++ constant + 1, but it looks like you already figured that out.

This is the VRController Lua binding code.

L->new_usertype<VrController>
(
    "VrControllerClass",
    sol::base_classes, sol::bases<VrDevice, Object>(),
    sol::meta_function::index, &Object::dynamic_get,
    sol::meta_function::new_index, &Object::dynamic_set,
    "ButtonDown", [](VrController& c, int b) { return c.ButtonDown(VrControllerButton(b - 1));},
    "ButtonHit", [](VrController& c, int b) { return c.ButtonHit(VrControllerButton(b - 1));},
    "ButtonTouched", [](VrController& c, int b) { return c.ButtonTouched(VrControllerButton(b - 1));},
    "GetAxis", [](VrController& c, int a) { return c.GetAxis(VrControllerAxis(a - 1));},
    "Rumble", sol::overload(
        [](VrController& c, VrControllerAxis a) { c.Rumble(a); },
        [](VrController& c, VrControllerAxis a, int d) { c.Rumble(a, d); }
    )
);

L->set("VRAXIS_TRIGGER", VRAXIS_TRIGGER + 1);
L->set("VRAXIS_TOUCHPAD", VRAXIS_TOUCHPAD + 1);

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

strange now it decided to work- just one of those days I guess.

while were on the topic of missing VR stuff
 

How exactly are we going to deal with the steam VR poses or do poses in general for our stuff, couldn't we just associate a animation frame or something with like our own system of doing it and just blending.
 

since were using openVR currently (and we perhaps should stay on) still there should be away for us to detect finger curl on the knuckles as far as I know its a 0.0-1.0 float for each of the fingers. I don't think openXR has that though since last i checked.

OS: Windows 10 Pro

CPU:  i3-10100 CPU @ 3.60GHz
GPU: NVIDIA 2060 Super - 8 GB

RAM: 32 GB

Link to comment
Share on other sites

Valve's support for the Knuckles controllers is currently a nightmare. You have to go through their Steam input system and use some JSON definitions in a file, but they won't provide an example of what it's supposed to look like. Any questions on their forum or Github go unanswered.

I'll contact somebody at Valve and see if I can get more info on this.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...