This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 15k traffic Daily!!!

Hold Me Tight – MR Tutorial for Nreal Light


Completion screen of sample

Now let’s attempt to seize the touched GameObject and transfer it. This tutorial is a continuation of the “U Can Contact This” tutorial. You probably have not but comple “U Can Contact This”, please proceed with the next tutorial first.



Pattern Repository



Run the pattern

  1. Clone Pattern Repository, Change present listing to HoldMeTight. And Open with Unity.
  2. (If you happen to don’t have NRSDK) Obtain NRSDK 1.7.0 from https://nreal-public.nreal.ai/download/NRSDKForUnityAndroid_1.7.0.unitypackage
  3. Open Construct Setting, change Platform to Android
  4. Open Venture, choose Property > import bundle > Customized Package deal and import NRSDKForUnityAndroid_1.7.0.unitypackage.
  5. Test Construct Settings > Participant Settings by referring to Configure Build Settings
  6. Press Construct type Construct Settings panel
  7. Set up *.apk on Android or DevKit.



Tutorial



1. First, full “U Can Contact This”

  • First, full “U Can Contact This”. This tutorial will proceed with “U Can Contact This”. You too can begin by cloning the pattern repository.



2. Test “Is Set off” on “TargetCube1”

  • Choose TargetCube1 from Goal on the Scene.
  • Test Is Set off from Inspector Panel. By checking this field, you possibly can set off occasions while you contact sport objects.



3. Chenge C# Script

  • Open C# Script “TargetCube.cs” on Property panel.
  • Change the code as follows.
utilizing NRKernal;
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
utilizing UnityEngine.EventSystems;
utilizing UnityEngine.UI;

/// <abstract>
/// Goal Dice Script
/// </abstract>
public class TargetCube: MonoBehaviour
{
    personal MeshRenderer meshRender;

    void Awake()
    {
        meshRender = remodel.GetComponent<MeshRenderer>();
    }

    // Begin known as earlier than the primary body replace
    void Begin()
    {
    }

    // Replace known as as soon as per body
    void Replace()
    {

    }

    /// <abstract>
    /// Show occasion log utilizing console
    /// </abstract>
    /// <param identify="collision"></param>
    personal void OnCollisionEnter(Collision different)
    {
        Debug.Log("Hit!");
    }

    /// <abstract>
    /// Set off Enter Occasion Handler
    /// </abstract>
    /// <param identify="different"></param>
    personal void OnTriggerEnter(Collider different)
    {
        Debug.Log("Enter!");
        meshRender.materials.shade = new Shade(1f, 0f, 0f);
    }

    /// <abstract>
    /// Set off Keep Occasion Handler
    /// </abstract>
    /// <param identify="different"></param>
    personal void OnTriggerStay(Collider different)
    {
        // Get Proper Hand
        HandState handState = NRInput.Arms.GetHandState(HandEnum.RightHand);
        if(handState.currentGesture == HandGesture.Seize)
        {
            // Get Index Tip Place of proper hand
            Vector3 handStateThumbTipPosition = handState.GetJointPose(HandJointID.IndexTip).place;
            // Set Hand R IndexTip Sphere place
            remodel.place = handStateThumbTipPosition;
        }
    }

    /// <abstract>
    /// Set off Exit Occasion Handler
    /// </abstract>
    /// <param identify="different"></param>
    personal void OnTriggerExit(Collider different)
    {
        Debug.Log("Exit!");
        meshRender.materials.shade = new Shade(1f, 1f, 1f);
    }
}
Enter fullscreen mode

Exit fullscreen mode



4. Run the tutorial

  • Press Play button and run the tutorial.



5. Construct

  1. Press Construct type Construct Settings panel
  2. Set up *.apk on Android or DevKit.

The Article was Inspired from tech community site.
Contact us if this is inspired from your article and we will give you credit for it for serving the community.

This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 10k Tech related traffic daily !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?