How to add bullet in controller? STYLY X PlayMaker
How to add
bullet in controller? STYLY X PlayMaker
In this tutorial
we learn about how we add bullet in the controller through playmaker and then
upload it into STYLY.
- I took a 3D sphere and made it Bullet. Then I apply yellow shade on it, so it’s looks like Bullet.
- After that I added rigid body component on it and also added capsule collider so when it collides to something it will perform specific action. After that I put this bullet into an empty game object named “bullet” and made a prefab of that bullet.
- After that I selected that bullet and then added an FSM in Playmaker and named that state as Moving forward. I follow this tutorial that already available on STYLY website. I added 2 actions of “add force” and “wait” and set their values that how much force required to a bullet when it move forward and how many second it wait until it destroy. Then I added another state of Dying and set its action as self-destroy.
- Now we have to set controller Right so it works as gun to fire the bullet. In the previous tutorial we access the controller Right. Now add a transition finished in Setup state. After that I added state waiting for trigger in playmaker by selecting guncontroller_R and added events on it of Global_TriggerPressDown_R and Global_TriggerPressUp. Next I added Transition of Global_TriggerPressDown_R in waiting for trigger state.
- Next I added new state spawning bullet with a transition from waiting from Trigger. I added action an action of get rotation in the Spawning bullet state and also get the rotation of spawn sphere. Next i added a state waiting and apply action of "wait" on it and set the value of wait to 0.2.
- After that I added another action of create object and drag Bullet prefab in Game Object option.
- After that I Uploaded my complete prefab of shooting gun game in STYLY.
- I simply drag my scene of shooting gun game from "My Models" in STYLY. And then publish it and test it through HTC Vive its working. I can fire bullet from my Gun.
Comments
Post a Comment