Streaming a Virtual Camera and Props
What you’ll need to do first is import a mesh (preferably cube) that has a joint in the centre (Figure 1). This can be done in any 3D software.
Once you’ve imported your mesh:
- Open the skeleton
- Right click on the joint and select ‘Add socket’ (figure 2)
- Rename the socket (figure 3)
Next, create an Animation BluePrint (ABP) for the prop:
1: Right click on the content browser.
2: Go Animation, Animation Blueprint (figure 4)
3: Then select your target skeleton, this is the skeleton for the cube mesh we imported (figure 5)
Once the Animation BluePrint has been created, rename and open it (figure 6)
Once the Animation BluePrint is open we will need to create one node. This is the 'Mocap Stream' (figure 7).
In the ABP right click and create a node called ‘MoCap Stream’ (figure 7):
1: Fill in the 'MoCap Stream’ node parameters. If you need more info about the ‘MoCap Stream’ and its parameter please refer back to Part 1: Streaming into UE4.
2: Go to details and set the ‘MoCap Server’
3: Scroll down in ‘Details’ and under ‘Streaming type’ enable ‘Use Rigid Body’
4: Beneath ‘Streaming Type’ set the import scale
OptiTrack Motive: 100
XSens MVN: 100
Vicons Blade: 0.1
Save and Compile. If your mesh starts moving, you know its streaming correctly.
Next step is creating a pawn, to do that:
1: Go back to the content browser
2: Right click
3: Choose 'blueprint class' (figure 8)
4: Click on ‘Pawn’ (figure 9)
5: Rename it
Next, open it up.
We now need two components, you can add components by going to the ‘+ Add Component’ (figure 10)
The first component is ‘Skeletal Mesh’ (figure 10)
And the second is a ‘camera’ (figure 11)
Make sure that the Camera is a child of the skeletal mesh (figure 12). This can be done by dragging the camera onto the skeletal mesh.
Next, select the ‘skeletal mesh’ (figure 12)
Under details, look for the ‘Mesh’ Drop down and set the skeletal mesh to the prop we imported earlier
Above mesh, set the ‘Anim Class’ to the props ABP we created earlier (figure 13).
Then select the camera.
In ‘details’ under sockets set the ‘Parent Socket’ to the prop socket we created at the beginning (figure 14)
Save and compile.
Back to the content browser
Right click and create another 'BluePrint Class' (figure 15)
This time select ‘Game mode base’ (figure 16)
Rename it once created
Now open the new Game mode base.
Under 'details' in the ‘Classes’ drop down, set the ‘Default Pawn Class’ to the ‘Prop Pawn’ we created earlier (figure 17)
Go back to the content browser and open the 'project settings' in the 'Edit' drop down in the toolbar (figure 18)
Once open go to ‘Maps and modes’
Under ‘Default GameMode’, set the ‘Default gamemode’ to the Game mode base we created earlier (figure 19)
Close project settings and Play the scene, you should start seeing everything from the virtual camera position. If like in my example (figure 20) your camera’s angled, you can correct this by jumping back to the Pawn we created and rotate the camera until it's to your liking (figure 21)
Compile and save once done.
If you're having any issues please visit our FAQ Page.