using UnityEngine; namespace HPJ.Presentation { public class MoveTowardsPoint : MonoBehaviour { public Transform target; public float speed = 5f; public float acceleration = 2f; private void Start() { transform.SetParent(null); } private void Update() { // Get the direction to the target Vector3 direction = target.position - transform.position; // Calculate the distance to the target float distance = direction.magnitude; // Move towards the target if (distance > 0.1f) { // Calculate the current speed float currentSpeed = speed + acceleration * distance; // Normalize the direction vector direction.Normalize(); transform.position += direction * currentSpeed * Time.deltaTime; } } } }