1
0
forked from cgvr/DeltaVR

quest marker that floats up and down and turns towards player

This commit is contained in:
2026-02-12 15:23:54 +02:00
parent d0b909a1ab
commit 3d804dfdaf
8 changed files with 442 additions and 9 deletions

View File

@@ -103,12 +103,6 @@ public class ShapeDetectionNPC : NPCController
private async void OnPlayerPressedKeyboard()
{
if (state == 3)
{
SpeakVoiceLine(4);
state = 4;
}
string inputPrompt = microphoneStand.GetTextOutput();
byte[] imageBytes = await InvokeAiClient.Instance.GenerateImage(inputPrompt);
GeneratedTexture = ModelGenerationUtils.CreateTexture(imageBytes);
@@ -116,8 +110,10 @@ public class ShapeDetectionNPC : NPCController
imageDisplay.sprite = sprite;
imageGenerationButton.Deactivate();
if (state == 4)
if (state == 3)
{
SpeakVoiceLine(4);
state = 4;
modelGenerationButton.Deactivate();
}
}

View File

@@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuestMarker : MonoBehaviour
{
public Transform movingPart;
public float amplitude = 0.1f; // How far up/down it moves
public float frequency = 1.5f; // Speed of oscillation
private Vector3 startPos;
private Transform playerTransform;
// Start is called before the first frame update
void Start()
{
startPos = movingPart.localPosition;
}
// Update is called once per frame
void Update()
{
// Float up and down
float offset = Mathf.Sin(Time.time * frequency) * amplitude;
movingPart.localPosition = startPos + new Vector3(0f, offset, 0f);
if (playerTransform != null)
{
// Turn towards player
Vector3 lookTargetPos = new Vector3(playerTransform.position.x, transform.position.y, playerTransform.position.z);
transform.LookAt(lookTargetPos);
}
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player Head")
{
playerTransform = other.transform;
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player Head")
{
playerTransform = null;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 146b6814753582e479a1893e2736b683
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: