How to access the controller and change it's default model controller to 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.




  •  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.



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



  • 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.




  •  Now use action “create game object” and apply position and rotation controller on it.




  •  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.





  •  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.



Comments

Popular posts from this blog

How to create animation in UNITY and then upload it into STYLY