Rotating Door by Using Function Parameters
In this example, we will learn the using of function exposing using the Reality Editor feature. We will rotate the door using two of parameters Degree and Speed. Regarding to parameter values the rotation of the door changed with interpolation speed.
This tutorial focuses on three main topics:
- Using ZD Actor Component.
- Using Blueprint Events.
- Using function parameters and exposing into Reality Setup.
Getting Started
- Click ADD NEW and then BLUEPRINT CLASS on Content Browser.
- Click Actor.
- Select actor on Content Browser. Rename it as RotatingDoorExample. Double click on it.
- Click ADD COMPONENT on Components tab. FInd and click on the ZDACTOR
- Click on the ADD COMPONENT and then find the STATIC MESH
- Rename Static Mesh Component's name as Door Static Mesh. On the Details Tab(right side of screen) click Static Mesh tab and select SM_Door as static mesh.
- Click Event Graph.
On the Event Graph, right click into space and search for "Custom Event" and click Add Custom Event.
- Rename it as Rotate the Mesh.
- Click on Rotate the Mesh. The details panel will be shown on right panel. Click on + button and add two parameters Degree and Speed with Float data type.
- Click ADD NEW and then select the FUNCTION under My Blueprint tab. Rename it as RotateDoor.
- Click on RotateDoor node on event-graph. Add two parameters on function. Rotation Degree and Speed. Right click on event-graph and search for Rotate the Mesh Event. Connect the nodes. Make sure your access specifier is public. You can give a category name.
- Click on event-graph again. Connect the nodes as shown in below. You can right click into space and search for finding corresponding nodes.
- Click COMPILE and SAVE
- Put your RotatingDoorExample instance to the level.
- Launch Reality Setup.
- Click PLAY button in Reality Editor.
- RotatingDoorExample actor node will appear in Reality Setup. Click RotatingDoorExample set RotationDegree to 90 and Speed to 20. Click Execute button. The static mesh(Door) will rotate to the 90 degree with 20 interpolation speed.
Conclusion
We learned how to execute a function on Reality Setup with using parameters. To expand functions to the Reality Setup, we need to add ZD ACTOR component to the Actor. We are able to set parameters on functions and call these functions in Reality Setup. The Reality Editor establishes a network connection between Reality Setup and provides real time function execute with parameters.