Difference between revisions of "Streaming to Unity"

From iPi Docs
Jump to: navigation, search
(Usage in Unity)
Line 8: Line 8:
  
 
{{Note|Streaming of multiple actors is not currently supported. In multi-actor projects, it streams an active (currently selected) actor.}}
 
{{Note|Streaming of multiple actors is not currently supported. In multi-actor projects, it streams an active (currently selected) actor.}}
 +
 +
Streaming protocol broadcasts UDP packets to a certain port on the local network. By default, the port used is ''31455''. You can change this value in '''Streaming Settings''' dialog which opens when you press a "gear" icon on '''Start Streaming''' button.
 +
{{Tip|You may need to adjust firewall settings to allow outgoing connections to this UDP port.}}
  
 
= Usage in Unity =
 
= Usage in Unity =
Line 20: Line 23:
 
* '''Mocap Data''' (MocapStudioClient) - set to a game object holding '''MocapStudioClient''' component.
 
* '''Mocap Data''' (MocapStudioClient) - set to a game object holding '''MocapStudioClient''' component.
 
* '''Root Joint''' (Transform) - set to a game object of character's joint (bone) to which the ''Hips'' joint of the actor model is mapped in motion transfer profile in Mocap Studio. Usually this is a root joint which is a child of the character game object.
 
* '''Root Joint''' (Transform) - set to a game object of character's joint (bone) to which the ''Hips'' joint of the actor model is mapped in motion transfer profile in Mocap Studio. Usually this is a root joint which is a child of the character game object.
 
= Network settings =
 
 
Technically, streaming protocol broadcasts UDP packets to a certain port on the local network. By default, the port used is ''31455''. You can change this value in '''Streaming Settings''' dialog which opens when you press a "gear" icon on '''Start Streaming''' button. If Mocap Studio and Unity are run on different PCs in the local network you may need to adjust firewall settings to allow traffic between them. I.e. allow outbound connections to the UDP port being used at a PC running Mocap Studio and allow inbound connections to that port at a PC running Unity.
 

Revision as of 08:58, 2 October 2019

Note.png
Note: Starting from iPi Mocap Studio v4.3.0.

iPi Mocap Studio is capable of realtime streaming of character's pose over network. This can be used to preview captured motion in an actual game scene inside the Unity editor.

Usage in Mocap Studio

To start streaming, go to the Export tab and press Start Streaming button. While streaming is active any changes to a pose of the actor in Mocap Studio (playback, tracking, manual edit etc.) are sent to the local network. If there is a target character applied for an actor then the program streams poses of that target character otherwise it streams poses of the actor model. To stop streaming press Stop Streaming button on the Export tab. Streaming also stops automatically when a project is closed.

Note.png
Note: Streaming of multiple actors is not currently supported. In multi-actor projects, it streams an active (currently selected) actor.

Streaming protocol broadcasts UDP packets to a certain port on the local network. By default, the port used is 31455. You can change this value in Streaming Settings dialog which opens when you press a "gear" icon on Start Streaming button.

Tip.png
Tip: You may need to adjust firewall settings to allow outgoing connections to this UDP port.

Usage in Unity

To get streaming data from iPi Mocap Studio in Unity you need to add several C# scripts to your Unity project. You can download them here (need link).

MocapStudioClient component reads data from the network. Add it to some game object which is always active. It has parameters:

  • Port (int) - the number of an UDP port to listen for data from Mocap Studio. Should be equal to the value of UDP port set in the Streaming Settings in Mocap Studio. The default value is 31455.
    Tip.png
    Tip: You may need to adjust firewall settings to allow incoming UDP connections to this port.

CharacterAnimator component applies motion data to a character. Add this component to a character game object. Position is applied to this game object and rotations are applied to game objects corresponding to skeleton joints. This component has parameters:

  • Mocap Data (MocapStudioClient) - set to a game object holding MocapStudioClient component.
  • Root Joint (Transform) - set to a game object of character's joint (bone) to which the Hips joint of the actor model is mapped in motion transfer profile in Mocap Studio. Usually this is a root joint which is a child of the character game object.