Raycasting to hit!

As you can see I have gotten a basic Raycast working to hit some targets! (The debug at the bottom right). How did I go about doing it you ask?

In reality it wasn’t as complicated as I had thought it would be.

After creating a new Vector3 called center which would be essentially the center of the screen, we set the Ray Origin to be from our Main Camera from the “center”.

Then we can store what we hit via the RaycastHit! With this I have just set it to do a Debug.Log when a hit is registered but this will stem later into hitting an enemy soon. It surprises me actually how simple it was to get this basic shooting mechanic made.

See you next post!

--

--

--

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

Recommended from Medium

10 things each Android application designer should think about Architecture

Different aspects of TesIntroduction

Java Memory Model fundamentals or How to build stormtrooper clones army in a correct way

Data Mapping in Kumologica

Flutter Result type

What false sharing is and how JVM prevents it

Using Pandas in AWS Lambda Functions

One-way ANOVA: Does the stance affect a UFC fighter’s win by knockout ratio?

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
Edward Kim

Edward Kim

More from Medium

From Prototype To Work Of Art

Lerp Squares — Part 3

Can You Make Money Out OF Your First Game ?

Learn to code by making a 2D space shooter game.