19/11/22 - Current Progress


Apologies for the large gap in-between posts; while I have made progress on the assignment I have neglected to post about it, largely due to my feeling that failures were not significant enough to post about. Even when I did make progress, it was often exhausting and in the days after I had a mental block towards posting.

This is my first post after actually beginning the development aspect of the assignment; since the start I have faced several significant issues with developing in Unreal, specifically 4.27. The source of which being that from 4.27 onwards there was a drastic change in the layout of the VR template with the normally easily accessible motion controller data being hidden within the VR pawn. While this was designed to increase efficiency in the code, it also became a lot more difficult for beginners to access and understand.

Initially, I was only able to get the controllers to interact with other in-game objects by attaching a collision box to each controller and using on collision events with the objects (button and lever) to trigger events. While this worked, it was not nearly in-depth enough for what I wanted, as I described in a previous post I wanted the player's controller Y axis to scale with the rotation. I did eventually achieve this, though not until a lot of delving into the template code and help from the lecturer of the course.

The below video shows the initial lever design using the collision triggers, the issues with this method are the lack of depth and that any object can trigger the collision box. This works for the button, but triggering a lever with a clipboard doesn't make a lot of sense.

https://drive.google.com/file/d/1tc87-PiIOh42wORrTkJbr7YASmfhzmnP/view?usp=shari...

Unfortunately, any tutorials on how to access the motion controllers in 4.27 or later were scarce and the few I did find did not work. This caused me to delve into the pre-made code for the grab component which seemed to be able to access the data that I needed. I eventually found that any reference to the grab component was passed through functions called directly from the VR pawn.

The below image shows the grab button input for the controller, from here you can see that the motion controller is passed into the "Try Grab" this function is a part of the grab component and the only way the controller can be referenced by objects using the grab component.

 In order to add to this, I had to add different grab types by making use of the enumeration switch that grab was using to determine the type of grab. I then created another component that is used to control movement that can be customised through switch statements for different movements like a lever and door handle. 

I initially tried to get the players controller to snap visually to the lever, I could not get this to work due to the static mesh being a visualization; a feature of the 4.27 open XR template. This meant the static mesh was not accessible through code. I tried reversing the grab component code so that the motion controller would become attached to the target object instead of the other way around; however this did not work as shown in the video below.

https://drive.google.com/file/d/1iiJYYJtMtmYCTmVrNE7hjv6pfGS-N0f9/view?usp=shari...

Through this method I was able to create the lever I outlined in a previous where the vertical movement was mapped into rotation. I will append this post with a link to a video of the lever working when I next set up for VR work. Currently when the lever is released mid-movement, it stays in that position; given time I may add code to get it to reset to the position it was last in with smoother movement.

Leave a comment

Log in with itch.io to leave a comment.