Skip to content
John Luxford edited this page Oct 19, 2017 · 8 revisions

This fork extends NewtonVR with additional functionality for creating multiplayer experiences and for recording motion and interaction data and playing it back via virtual hands. There is a pull request in the main project for these changes, but in the meantime these will be maintained and documented here.

New events

We've added OnBeginUseInteraction and OnEndUseInteraction events to the NVRHand component so we can capture not just the beginning and end of an interaction (picking up or controlling an object), but also using it (for example, pressing the trigger on a gun object).

Separate right and left-handed interaction points

We've added an NVRHandedInteractableItem component that allows you to assign per-hand interaction points. An example use was ensuring a walkie-talkie is rotated correctly to how you'd naturally hold one for both hands.

Snapping objects to a grid and limited rotations

Use NVRInteractableItemSnappable in place of NVRInteractableItem to create objects that can snap to the nearest meters and degrees, or to the nearest horizontal surface. Use the index finger trigger to enable/disable snapping to degrees.

Virtual hands for multiplayer and playback of interactions

NVRVirtualHand extends NVRHand to add public methods for controlling the hand programmatically. To create remote players, create an object structure like this in your scene:

RemotePlayer
    Head
    LeftHand
    RightHand

Attach the NVRVirtualHand component to each hand object and attach your avatar models as children under each component. Movements can be transmitted between players using one of the networking solutions for Unity, controlling the head, hands, and player space (for example for teleporting).

Adding interactions works like this:

  1. Listen for the OnBeginInteraction, OnEndInteraction, OnBeginUseInteraction, and OnEndUseInteraction events and transmit those to the remote players (including the hand and the name of the object being interacted with).
  2. On the receiving end, feed these events to NVRVirtualHand's Hold(objectId), Release(), Use(), and EndUse() methods.