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

[SHOWCASE] clisycp

CodeIgniter Tutorial — CI MVC Framework

أول مكن عد نقود يعمل داخل السيارة 🚗 بالوطن العربي مقدم من شركة BVS الرائدة في مجال بيع و صيانة…

The emotional rollercoaster of being a founder

Using Technical Debt as your next Tool

Redux From Scratch (Chapter 9 | Moving Forward)

New to Jamstack? Everything you need to know to get started | Xmartlabs Blog

The Computing Conference 2018 Workshop: Log Based Security Analysis

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

What feels like the end is often the beginning

Arcane Review III: 5 Questions Viewers Needed Jinx and Vi to Ask

How Singing Robots Helped Me Love My Own Voice

How to Map OneDrive to a Drive Letter in Windows 11?