About 'Check For Distance'!

In this video (objectives)…

  1. Create a condition where towers only shoot if enemy is within range.
  2. Implement Vector3.Distance to determine distance from towers to enemies.
  3. Turn on and off particle emission system if there is no valid enemy.

After watching (learning outcomes)…

Create a condition where towers only shoot if enemies are close enough.

(Unique Video Reference: 24_RR_CU2)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

Video was great, but I noticed a small redundancy error.

When calling Vector3.Distance();, you used targetEnemy.transform.position, but targetEnemy was declared as a Transform, so it was effectively saying transform.transform.position. Should be improved to: Vector3.Distance(targetEnemy.position, objectToPan.position).

1 Like

I agree, thanks for that. It’s actually not possible to change code in the middle of a course as it’s built-on in future videos, but point noted.

Enjoy the course

1 Like

Privacy & Terms