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: Flip Object to match which hand you pick it up in
//
//=============================================================================
using System.Collections;using System.Collections.Generic;using UnityEngine;
namespace Valve.VR.InteractionSystem{
public enum WhichHand { Left, Right }
[RequireComponent(typeof(Throwable))]
public class Equippable : MonoBehaviour {
[Tooltip("Array of children you do not want to be mirrored. Text, logos, etc.")] public Transform[] antiFlip;
public WhichHand defaultHand = WhichHand.Right;
private Vector3 initialScale; private Interactable interactable;
[HideInInspector] public SteamVR_Input_Sources attachedHandType { get { if (interactable.attachedToHand) return interactable.attachedToHand.handType; else return SteamVR_Input_Sources.Any; } }
private void Start() { initialScale = transform.localScale; interactable = GetComponent<Interactable>(); }
private void Update() { if (interactable.attachedToHand) { Vector3 flipScale = initialScale; if ((attachedHandType == SteamVR_Input_Sources.RightHand && defaultHand == WhichHand.Right) || (attachedHandType == SteamVR_Input_Sources.LeftHand && defaultHand == WhichHand.Left)) { flipScale.x *= 1; for (int transformIndex = 0; transformIndex < antiFlip.Length; transformIndex++) { antiFlip[transformIndex].localScale = new Vector3(1, 1, 1); } } else { flipScale.x *= -1; for (int transformIndex = 0; transformIndex < antiFlip.Length; transformIndex++) { antiFlip[transformIndex].localScale = new Vector3(-1, 1, 1); } } transform.localScale = flipScale; } } }}
|