In this article, I introduce how to make a slow-motion effect in STYLY’s VR space by Playmaker for Unity.
It involves the operations by the mouse and the controller of HTC Vive.
The completed state is shown above.
Only when you keep the trigger pulled, the slow-motion effect is activated.
Confirm sample assets with WebEditor
* If you register STYLY, you can check the sample assets created with this TIPS with WebEditor.
If you do not register an account, please register again and click this button again.
You can taste a sample space in STYLY GALLERY.
You can download the Unity project shown in this article.
Playmaker and Steam VR Plugin
Download the both from Asset Store to use in Unity.
Playmaker is a paid asset.
Steam VR is free.
Make a Bullet
I add a bullet to visualize the motion.
Rename the Sphere “Bullet” and scale it by 0.1 in x, y and z.
Open Playmaker Editor with the bullet selected.
Select “Add FSM” from right-click context menu.
Now a State has been created.
I renamed FSM “Bulletspeed”.
Next, add actions to the Bullet.
Click “Action Browser”.
Selecting Translate under Transform section in the Browser, click “Add Action To State”.
An action has been added.
Set the speed of the bullet.
I set Z to 7 in this example.
Make it a Prefab.
Set a spawn point for the bullet
Make a cube with the name, “Bulletspawn”. Uncheck the box of Mesh Renderer.
I also add an FSM to the Bulletspwan by Playmaker.
Add “Find Game Object” by “Add Action”.
Select “Main Camera” from “With Tag” to find the objects with the tag, “MainCamera”.
Create a new variable by “New Variable” and store it to the found object.
I name the variable “Main Camera” in this example.
Create a State by “Add State”.
Add an action, “Look At” in “Transform” section.
Set the target of “Look At” to MainCamera I created earlier, and uncheck the box of “Keep Vertical”.
Set Transition of State1 to Finished.
Then, connect it to State2.
Next, create Stage3 and add the Action, Create Object.
Specify the object to create.
Set Game Object to “Bullet” and Spawn Point to”Bulletspawn”.
Add the action, “Send Event” and set Transition to FINISHED.
Connect State2 to State3.
To make an iteration, connect Stage3 back to Stage2 as well.
Add “Wait” to shoot every one second.
I set the interval to one second.
Set “Finish Event” to FINISHED.
In this state, the bullet never stops so “Destroy” it at a suitable point.
Set “Destroy Object” to Bullet and Delay to 4 seconds.
This article introduced how to create bullets automatically by Playmaker for Unity.
I will introduce how to implement a slow-motion effect on it in the next article.
Next article >>
How to make slow-motion effect by Playmaker in Unity_vol.2
How to upload an asset from Unity to STYLY
Read this article