Swapping Model Prefabs between Grabbable and Teleport Interactions
bmdenny opened this issue · comments
What is the best way to swap the model prefabs when switching between direct interactors and teleporting? For example, I am looking to show VR Hands when grabbing objects and swapping to the controller prefab when teleporting.
The controller prefab is used for both the Base Controllers and Teleport controllers and is active for both at the same time.
SOLVED
In the ActionBasedControllerManager script I changed the OnExitSelectState() function – line 456 so that the base controller model is hidden when teleporting and the controller is shown.
case StateId.Teleport:
DisableAction(m_Turn);
DisableAction(m_Move);
SetBaseController(false);
// control model prefabs to show
m_BaseController.hideControllerModel = true;
m_TeleportController.hideControllerModel = false;
I changed the check for the teleport action being cancelled in the OnUpdateTeleportState() function to do the opposite.
if (cancelTeleport || releasedTeleport)
{
TransitionState(m_TeleportState, m_SelectState);
m_BaseController.hideControllerModel = false;
m_TeleportController.hideControllerModel = true;
}
In the Start() function I hid the controller model
m_TeleportController.hideControllerModel = true;