[18] Scripting Sharply, I See
- 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:

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:

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

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

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:

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

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:

![[158] Most Important Brick in the Least Important Wall](https://static.wixstatic.com/media/df100d_f70be6ae4318455fbbc605cd1069c6ee~mv2.jpg/v1/fill/w_980,h_410,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/df100d_f70be6ae4318455fbbc605cd1069c6ee~mv2.jpg)
![[157] Mail Order Sacrifice](https://static.wixstatic.com/media/df100d_e284fa6c51b04524bab9d3cf9f1f6441~mv2.png/v1/fill/w_980,h_382,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/df100d_e284fa6c51b04524bab9d3cf9f1f6441~mv2.png)
![[156] Moat of Babble](https://static.wixstatic.com/media/df100d_091e451794b14aecb494a16c15c966c3~mv2.png/v1/fill/w_980,h_705,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/df100d_091e451794b14aecb494a16c15c966c3~mv2.png)
Comments