Another case of Keep It Simple Stupid. I wanted to create enemy space ships that entered at the top corners of the the screen and flew diagonally across. While searching, I found multiple different ways to do it. The search for ways to do certain things in unity can be tricky. There are different ways to manipulate Vector3, sometimes when searching it is hard to find the right path if you are not asking the right questions.

First I tried to use:

While it did move diagonally from where I wanted, it dropped back to the background on the z-axis. Not what I was looking for.

Then I tried:

It was another one that dropped it back on the z-axis. It also spawned it in the wrong area, so that didnt work. Back to the documentation then. I thought to myself in the first place that it couldn’t be as easy as adding two static properties of Vector3 together to make a diagonal direction. Of course though, keeping it simple was the best way to go. It seems to work out that way quite often, but only after I tried the difficult stuff first.

This is what I ended up with:

It ended up working exactly how I wanted, I made the diagonal enemy smaller so it was a little harder to hit and because it is moving diagonally it is moving faster. I made one from each sideJust another reminder for me that sometimes the least complicated solution is the best. Here is the entire method with the three different types of enemies:




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Build .Net Core projects with Jenkins for Linux

A brief look at how the internet works

Understand The Memory-Factor — A Quick Workshop To Faster Development.

Securing GitLab +Docker CI Pipelines

The Ultimate Guide to Making a Static/Responsive Portfolio Website with Tailwind CSS

Docker explained for getting things done

15 Java and Programming Articles You can Read during COVID-19

After Validation Hook in Laravel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaron Black

Aaron Black

More from Medium

A Brief History: The Quantel Paintbox

Kill the Avatar

An Eco-Critical Translation of “Sir Gawain and the Green Knight” — First two stanzas of fitt 1