1
0
forked from cgvr/DeltaVR

quest marker slowly moves towards next target position

This commit is contained in:
2026-02-17 17:50:10 +02:00
parent 5c7103a79b
commit dfcce63371
2 changed files with 10 additions and 10 deletions

View File

@@ -1,5 +1,4 @@
using System.Collections; using DG.Tweening;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class QuestMarker : MonoBehaviour public class QuestMarker : MonoBehaviour
@@ -8,6 +7,7 @@ public class QuestMarker : MonoBehaviour
public float amplitude = 0.1f; // How far up/down it moves public float amplitude = 0.1f; // How far up/down it moves
public float frequency = 1.5f; // Speed of oscillation public float frequency = 1.5f; // Speed of oscillation
public float heightAboveTarget = 0.75f; public float heightAboveTarget = 0.75f;
public float moveToTargetDuration = 2f;
private Vector3 startPos; private Vector3 startPos;
private Transform playerTransform; private Transform playerTransform;
@@ -57,13 +57,13 @@ public class QuestMarker : MonoBehaviour
public void MoveTo(Transform target, bool attach = false) public void MoveTo(Transform target, bool attach = false)
{ {
transform.position = target.position + new Vector3(0, heightAboveTarget, 0); hoverAboveTransform = null;
if (attach) transform.DOMove(target.position + new Vector3(0, heightAboveTarget, 0), moveToTargetDuration).OnComplete(() =>
{ {
hoverAboveTransform = target; if (attach)
} else {
{ hoverAboveTransform = target;
hoverAboveTransform = null; }
} });
} }
} }