About 'Make Projectile Move'!

In this video (objectives)...

  1. Compare animating projectile using animator versus code.

After watching (learning outcomes)...

Animate projectile using both animator and code.

(Unique Video Reference: 16_GL_CUD)

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!

In the previous project “Laser Defender”, we make the projectile move with rigidbody’s velocity (iirc). It made more sense as you can then easily tune movement speed of the projectile via a variable.

I think most students like me would like to understand why we chose to use animation to move the projectile now, and what are the pros and cons of the 2 methods. It could be because you just wanted to show us an alternative way to do things (even though the rigidbody’s method might be better), but I think it would be helpful if you mention that so it doesn’t interrupt our train of thought.

Hi,

You are not actually using animation to move the GameObjects, the animation is purely for changing it’s appearance by changing the current sprite, or, in the case of projectiles, rotating them.

The movement is all taken care of via transform.Translate. You can still fine tune by changing the walkSpeed variable;

transform.Translate(Vector2.left * _walkSpeed * Time.deltaTime);

(the above is taken from Attacker.cs hence Vector2.left)

Hope this helps. :slight_smile:


See also;

oh ok, i got to the end of that lesson and that’s where we actually make the projectile move (using transform.translate made sense). My bad.

I was really confused at the start when we were asked to animate the projectile flying across the screen, because I couldn’t see the point of doing that. Looking back, that step is probably unnecessary (maybe he just wanted to see the projectile moving to preview the rotation animation).

I’m not entirely sure which part of the lecture you are referring to with regards to anything being unnecessary, but Rick does drop GameObjects into the scene to test new functionality as it is added.

In the original course I think the projectiles were done slightly earlier, it also included the rotation which, for the zucchini at least wasn’t covered in the remastered content. On that note, set the keyframes to Auto (right-click) rather than Clamped Auto and you won’t need to fiddle around with the curves as shown in the lecture(s).

Privacy & Terms