Forked from
Nicolas Leins / BWM MRTK Project
7 commits behind, 4 commits ahead of the upstream repository.
-
JonuziFlorina authoredJonuziFlorina authored
Notizzettel.cs 1.02 KiB
using Microsoft.MixedReality.Toolkit.Input;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Notizzettel : MonoBehaviour, IMixedRealityTouchHandler
{
public TextMeshPro textMesh;
void Start()
{
SetTextVisibility(false); // Initial unsichtbar
}
public void OnTouchStarted(HandTrackingInputEventData eventData)
{
SetTextVisibility(true); // Sichtbar machen
}
public void OnTouchCompleted(HandTrackingInputEventData eventData)
{
SetTextVisibility(false); // Wieder unsichtbar machen
}
public void OnTouchUpdated(HandTrackingInputEventData eventData) { }
void SetTextVisibility(bool isVisible)
{
if (isVisible)
{
textMesh.color = new Color(textMesh.color.r, textMesh.color.g, textMesh.color.b, 1.0f); // Voll sichtbar
}
else
{
textMesh.color = new Color(textMesh.color.r, textMesh.color.g, textMesh.color.b, 0.0f); // Unsichtbar
}
}
}