Starting our organization of files and creating a system of naming conventions in a way that satisfies our needs as a team
Getting another pass on the gaze interaction to replace the rotation with the activation of a dynamic material
Creating proxy parent and child materials for our active props
I based the folder structure off of this style guide, with alterations to fit our team's needs. This will help us organize assets based off of their functions (art, programming, vfx), and within them, separating into subsections that will automatically sort by sticking to our naming conventions.
This is how our source art folder looks in perforce:
My goal for the next pass of my gaze interaction was to move away from rotation, and onto working with materials, as that will be necessary for the final product. I had a bit of trouble with it this round, as I had to change both the logic of how the gaze's activation works, and switching the kind of asset it affects.
In our 'Line Trace Forward' function, I added two functions for the material, 'Create Dynamic Material Instance' and 'Set Scalar Parameter Value on Materials'. We grab the parameter that holds the static mesh object which has the material assigned to it in the BP_GazeInteractableCube. I've done the same within the 'Basic Gaze' function. Then in the 'Activate' function, instead of the ShouldRotate value setting the rotation rate, I used it to swap between 0 and 1, depending on if it's true or false, which will be sent into the material's scalar parameter that I have multiplied against the base color.
Here are some proxy materials for our active props:
And finally this is the result of the blueprints during gameplay!
For our VR project, I want to create an interaction with Medusa based on the player's gaze. Working with a Meta Quest 2, I was a bit limited in being unable to track eye movement, but fortunately, I'm able to cast a ray from the position of the VR headset that triggers an interaction if the ray hits a specific object.
The first step is to get the Pawn Blueprint for the VR player. We'll create a function that casts the ray from the player's camera called 'Line Trace Forward'. Into the 'Line Trace By Channel' function, we bring in the camera's world location for the starting position, and calculate the end point by adding together the world location and the forward movement from the world rotation. To check if the rays are casting correctly, select the 'Draw Debug Type' dropdown menu in the 'Line Trace By Channel' function and select, 'For Duration.'
Line Trace Forward Function in VR_Pawn
Next, we're gonna create another function for the VR player that tracks the gaze and where the ray hits. We'll feed the 'Line Trace Forward' function through 'Break Hit Result' to say if we hit something, we'll send the object it hits to another blueprint I'll discuss later, and if the object the ray cast hit is an object that we can interact with, we'll send that data to our next blueprint, 'Interact.'
Basic Gaze Function in VR_Pawn
This function double checks for us if the object is valid and if so, to bring it to the 'Activate' function in our next blueprint class.
Interact Function in VR_Pawn
Next we need a parent blueprint class that will allow us to create multiple children of different interactable objects. I've titled it, BP_GazeInteractable. Inside this parent class, all we need to do is create an 'Activate' function. From there, we create a child off of that blueprint. In our child blueprint, we'll bring the static mesh of the object we want to be interactable, under the 'Components' tab. Additionally under that tab, we'll add a 'Rotating Movement' component as the action we'll take when activated.
In our 'Activate' blueprint, we'll create a boolean to hold the true/false values of if the cube can rotate, with true activating the rotation, and false halting it. In the 'Select' node, leave 'False' as it is, and change the Z value under 'True' to 180.
Activate Function in BP_GazeInteractive_Child
Back to our pawn blueprint, make sure that our 'Basic Gaze' function is connected to the 'Event Tick' node, and we should be good to go!
Event Graph in VR_Pawn
Here's a demo of how it looks with the draw debug lines on!