BenWoodford / SteamVR-Webkit

Toolkit for building WebKit-based overlays for SteamVR.
MIT License
23 stars 10 forks source link

Run Time Controller Offset Position/Rotation #5

Open robnewton opened 7 years ago

robnewton commented 7 years ago

I am having a hard time getting the rotation and position of an in-game overlay. It would be very helpful to adjust that at runtime with some HTML5 range sliders through a JS callback. Can you point me in the right direction for how to update the position of the overlay at runtime? I can handle all of the connector stuff to get it working in the HTML/JS overlay.

BenWoodford commented 7 years ago

This passes the overlay instance to the browser. You can then manipulate it like this using relative or absolute values (see Overlay.cs for full details).

robnewton commented 7 years ago

Excellent thank you. Can you paste the lines here that you were passing in the developer console? Can't read them in the gif

BenWoodford commented 7 years ago

It's just calls to methods in Overlay.cs, following the CefSharp conversion of lower-camelcase so the first letter is always lower-case

robnewton commented 7 years ago

Oh, I see. Thanks a lot

robnewton commented 7 years ago

Looks like this isn't working when position is attached to a controller. Any rotation applied causes the overlay to disappear. I tried the 45 degree rotation you use in you gif example and it's the same effect. If I change to absolute positioned overlay, then rotate works fine however. Appears to be related to controller attachment only.

BenWoodford commented 7 years ago

I didn't thoroughly test controllers so it's possible. Worth noting that if you face it away from you, it simply won't render as it'll be backface culled

robnewton commented 7 years ago

OK I'll dig into fixing