UEVR: UObjectHook
What is UObjectHook?
UObjectHook is an extra part of UEVR that can be used to do many things, such as:
- Attach the camera to any object or component in the game
- Add 6DoF motion controls by attaching any components to the motion controllers
- This is usually contingent on the 3DoF motion controls working in the first place
- Modify and view any property of any active UObject in the game
- This can be saved by right clicking the property
- Toggle the visibility of any component in the game
- Save the state of all of the above for persistence across sessions
Important information
UObjectHook is not enabled by default. When giving out profiles, ensure you have "Enabled at Startup" enabled under UObjectHook's config tab.
If a profile received does not work, it is likely because of the above. UObjectHook is not enabled by default, so you need to manually open the UObjectHook menu to enable it if this is the case.
Examples
In the following examples, we'll be using the "First Person Template" from the Unreal Engine.
These are just the simplest examples possible. There are games that will have differently named components. Sometimes you'll need to go through multiple component lists, children, or properties. You'll usually want to be on the lookout for SkeletalMeshComponent components for attachments.
Attaching the camera to an object
In this example, we'll attach the camera to the local player/pawn.
- Open the in-game menu and enable advanced options if not already enabled
- Navigate to UObjectHook on the left side
- Go to "Common Objects"
- Go to "Acknowledged Pawn"
- Click "Attach Camera to" (click "Attach Camera to (Relative)" if the game is already first-person)
- Click "Save State"
Doing this allows you to turn third person games into first person games. If done in a first person game, this removes unwanted camera movement that should not be there in VR.
Attaching components to motion controllers
In this example, we'll attach a component(s) to the motion controllers.
- Open the in-game menu and enable advanced options if not already enabled
- Navigate to UObjectHook on the left side
- Go to "Common Objects"
- Go to "Acknowledged Pawn"
- Go to "Components"
- Click "SkeletalMeshComponent Mesh2P" and uncheck "Visible"
- Click "SkeletalMeshComponent FP_Gun"
- Click "Attach right" or "Attach left" depending on which controller you want to attach to
- Click "Adjust"
- The menu will close, move your controller so that it lines up with the gun in-game
- Open the menu again, and the weapon should be attached to the controller with the correct offset
- Now click "Permanent Change", this will allow the projectiles to fire from the correct location
- Click "Save State"
- Navigate to "Input" on the left side
- Change the "Aim Method" to "Left Controller" or "Right Controller" depending on which controller you attached the weapon to
- You should now have full 6DoF motion controls for the weapon
Glossary
Permanent Change
This means that UEVR will no longer reset the object back to its original position and rotation after rendering is over. This can make projectiles come out of the correct spot with weapons, and make things like colliders work with melee weapons (if they have them).
It is not enabled by default because the user can inadvertently set this option on something that dictates their player position, launching them out of the map.