What I’m trying to do is essentially emulate something like what you get in the VR Editor mode, where if (on the Vive) you squeeze the grip buttons on both the controllers, you can use that to scale and move the world around you.
Starting from something similar to the 4.13 VR template, my intention is to use player input to change the transform on VROrigin and basically have the player make themself bigger or smaller, and otherwise transform when they grip both controllers and move them. In such a way that from your perspective it looks like the controllers remain static in the world, but the world moves around you with them when you move the controllers.
As such, mostly just wondering if that’s a control system anyone has already tackled or found a straightforward way of doing. Otherwise, I’ll put the blueprint up here for other people’s reference once I figure it out
Okay, mostly got it figured out. The following mostly works just fine, so I figure I’ll document it to save anyone else doing the same thing time.
This is just extending the default pawn with motion controllers in the 4.13 VR starter set, which has a Root component, a VROrigin scene component under that, and then the camera and the two controllers get attached under VROrigin.
Essentially what it’s doing is storing the positions of the controllers on the previous tick, then getting the current positions of the controllers, working out a delta transform from the old positions to the new ones and applying that transform to the VROrigin. Some of the math is a bit hacked together because you can’t just write matrices in blueprint and I don’t know how to make Transforms particularly elegantly.
The trickiest thing has been figuring out scale. I initially figured I could just transform the VROrigin directly, but while that works for translation and rotation, things get screwy for the headset controller and its IPD when rescaling. So in the end I’m translating and rotating the VROrigin, but the scale is applied through Set World to Meters Scale only.
That introduces the problem of how you calculate the delta between the old and new positions of the controllers, given that they are moving themselves along with the rest of you through the world. I figured I’d avoid it being self-referential by only getting the controller positions to store as the ‘old’ positions after applying the transform, so at the start of the next tick the old and new positions are in the same space, but Set World to Meters Scale only seems to kick in at the next tick, so when you store the controller positions after that, they’ve been rotated and translate, but not scaled. So you need to store the scale factor and apply it manually to the stored positions, so that they’re in the same space as the new positions on the next tick.
You want to apply the translation separately. This error wasn’t really noticeable in the really small deltas when creating a transform from frame to frame, but was causing big offsets when using the point-to-point transform in more general cases (it’s a decent enough way to line up a scan of a real space with the actual space).
Sorry to necro this thread, but its literally the only one I’ve found that talks about this type of interaction. I think as @Holoplex had mentioned, the BP for the “Construct Transform” function seems to be missing. I’ve ventured to guess what it would contain, but I don’t think I’m getting anywhere close to the mark.
Sorry to again “Re-Necro” this thread. Is this a valid solution to try to implement? I don’t need to scale or rotate. I just need to be able to move myself or the level up, down, left or right by using the grip buttons and moving the controller up, down, left, or right.
Necro: I’m building similar functionality, I have Grip/Grab movement and rotation working well but scale is giving me all sorts of problems.
Has anyone been able to solve this in a way they’re willing to share? Here or via email etc…
When I finish this push I’ll try to circle back and make a post to share my implementation of grab movement/rotation (and scale if I can get it to work) with the broader community, it’s took me way to long to get to this point and I have so much more to do, but other people’s shared efforts definitely helped along the way.
Hey, back again, I finally got scale working! Put that part of the project down, then came back to it today with fresh eyes and here we are, 5 hours later and it works. I’ve updated the previously linked github repo with the updated code. So if anyone finds this in the future, that’s the place to look for the example implementation.