How to access the controller through Playmaker and change it's default model controller to any other Model

How to access the controller and change it's default model controller to any other Model:

  • For accessing controller, first we create an empty game object in playmaker hierarchy. The tutorial is already available Here. After that add a state in FSM by selecting  gunController_R.
1.jpg
  •  By following that tutorial I use action find game object and then get position and get rotation of the controller.
  •   After getting position we create variable to store position value of position of controller.

 

2.jpg

 

  • Same as above after using action “Get rotation” create variable to store the value of controller.
3.jpg

 

  • Then, add a 3D model gun “SciFiHand” that will work as shooting gun in this scene. You can add anything. Then add a sphere as child object in front of SciFiHand so it behaves as Spawn point. After that, uncheck its mesh renderer so it’s not visible. We hide it’s mesh because we want its functionality not its mesh. So spawn point is basically the point from where we fire bullet from the gun.
4.jpg
  •  Now use action “create game object” and apply position and rotation controller on it.
5.jpg

 

  •  Next create a Set Parent action and set the “SciFiHand” parent to be the controller. Setting the “SciFiHand” as a child of the controller with move the “SciFiHand” around with the controller at all times. Next, add a Get Child action and locate a child of the SciFiHand object called spawnPointSphere.
  • After storing all values of controller now we delete the controller prefab that we can use our own model instead of controller. So for that purpose we have to delete the controller model. So, I add an action of Destroy object.

 

6.jpg

 

  •  As in this scene gun is used for shooting purpose. Now controller is fully functional and we can use it to perform any task. I uploaded my model in STYLY and then test it by HTC Vive so my controller converted to gun.
    Please look at our tutorial video for more clarification.

 

Please look at our tutorial video for more clarification.

For URDU or HINDI version of this tutorial, please click here.

 

 

Written By: Zubaira Naz