2021년 4학년 1학기 기업연계프로젝트2
컴퓨터소프트웨어공학과 <원광투어팀>
팀장 : 송유진
팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Triggers haptic pulses based on distance between 2 positions
//
//=============================================================================
using UnityEngine;using System.Collections;
namespace Valve.VR.InteractionSystem{ //-------------------------------------------------------------------------
public class DistanceHaptics : MonoBehaviour { public Transform firstTransform; public Transform secondTransform;
public AnimationCurve distanceIntensityCurve = AnimationCurve.Linear( 0.0f, 800.0f, 1.0f, 800.0f ); public AnimationCurve pulseIntervalCurve = AnimationCurve.Linear( 0.0f, 0.01f, 1.0f, 0.0f );
//-------------------------------------------------
IEnumerator Start() { while ( true ) { float distance = Vector3.Distance( firstTransform.position, secondTransform.position );
Hand hand = GetComponentInParent<Hand>(); if (hand != null) { float pulse = distanceIntensityCurve.Evaluate( distance ); hand.TriggerHapticPulse((ushort)pulse);
//SteamVR_Controller.Input( (int)trackedObject.index ).TriggerHapticPulse( (ushort)pulse );
}
float nextPulse = pulseIntervalCurve.Evaluate( distance );
yield return new WaitForSeconds( nextPulse ); }
} }}
|