Why make getting the enemy unit's position so complicated?

We don’t need some fancy methods to call on a grid position for it. It’s a gameObject. Which has a transform and thus a transform.position.

    case State.Aiming:
        float rotateSpeed = 10f;

        Vector3 aimingDirection = (targetUnit.transform.position - transform.position).normalized;
        transform.forward = Vector3.Lerp(transform.forward, aimingDirection, Time.deltaTime * rotateSpeed);
        break;
1 Like

In this case, you’re absolutely right. It’s easy to overlook the obvious in a system where most other calculations do require conversions.

1 Like

I still added the method as done in the lesson, just in case.
And what does it do? Simply return the unit’s transform.position:laughing:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms