top of page
Search

[18] Scripting Sharply, I See

  • Writer: Conlan Walker
    Conlan Walker
  • Jan 28, 2022
  • 2 min read

Dumb title, but whatever.


This week I started working on using C#, which is the language Unity uses natively.

I can't really say that most of the base syntax is hard, because I already know a bit of C.

Before that, however, I wanted to iron out some things from the original lesson.

I said, in the last post, that I never got around to making a level and adding that particle effect damage prefab. So I started with the latter:

ree

After some consideration, I didn't want to invest much time into something I wasn't all that invested in to begin with, so I thought that cementing some things regarding proBuilderTools would suffice.

For example, the first one is the result of scaling a specific group of faces on an icosphere:

ree

And this one was created from just twisting extruded faces on a cube:

ree

Once I finished with that, I could move on to scripting.

ree

I started off with the normal hello world script, before creating this one that just counts up forever.


There was a lesson I was given, and there were assets I was given, though I wanted to start off with the basics and start from scratch, as that's generally the way I like to learn these things. The only problem with that is that when I say "from scratch", I mean it.

Generally speaking, I will not move on to learning another method until I know everything about it.

After getting my bearings on the basics, I looked up a tutorial on making an FPS controller.

I wasn't able to complete the tutorial before I had to write this, but I did manage to finish the looking around portion of it. I started by setting up a simple character within a simple level:

ree

Next, I messed about for hours tinkering with the concept of converting an Euler rotation to a quaternion representation, before applying that rotation to a given camera.

I was following a tutorial on an FPS controller, sure, but it never explained a lot of things I wanted to know, so I had to rely on API documentation at some point

ree

The tutorial didn't actually call for a lot of the things shown here, like applying mod 360 to rotationX.

I figured out that deltaTime = thisTime-lastTime. It's used to apparently have an output be constant irrespective of framerate. It compiled without issue, and I opened it up:

Nice.


To finish this off, here's the weird effect that occurs if I change the %= 360 to %180:


 
 
 

Comments


bottom of page