About the author:

All posts by Terence:

Fixing a jittery camera in Unity
Screenshot from Cobalt Blue, a game currently in development.

Fix jittery camera movement in Unity with Rigidbody Interpolate

If you’ve got a player character in your game that derives its movement from a Rigidbody or Rigidbody2D component in Unity, and you write a script to make your camera follow it, you will likely see jittering in your camera movement.

Here’s an example:

Camera jitter in Unity
It’s not very noticeable if you don’t move at high speeds.
Continue reading
Animator does not contain a definition for SetBool

Unity C# error: Animator does not contain a definition for ‘SetBool’

Recently, I came across an error that was quite the head-scratcher while grading some Unity scripts. Here’s what the error says:

Animator does not contain a defintion for 'SetBool'
The myAnim variable was set with myAnim = GetComponent<Animator>() earlier on.

But SetBool() is a valid method in the Animator component from Unity, so what exactly is going on here?

Continue reading
Importing CSV files into a MySQL table

Importing a CSV file into an SQL table

CSV stands for Comma-Separated Values, and CSV files are text files that look something like this:

example.csv

Username,Email,Address,Contact
johndoe,john@example.com,"71 Pickering Street, Singapore, Singapore",+65-91234567
janedoe,jane@website.com,"24 Raffles Lane, Singapore, Singapore",+65-81234567
marysmith,mary@smith.com,"83 Riveting Road, Singapore, Singapore",+65-97654321
bobsmith,bob@smith.com,"84 Riveting Road, Singapore, Singapore",+65-87654321

Essentially, the CSV file format is meant to represent tabular data. The above CSV file represents the following table:

UsernameEmailAddressContact
johndoejohn@example.com71 Pickering Street, Singapore, Singapore+65-91234567
janedoejane@website.com24 Raffles Lane, Singapore, Singapore+65-81234567
marysmith mary@smith.com 83 Riveting Road, Singapore, Singapore +65-97654321
bobsmith bob@smith.com 84 Riveting Road, Singapore, Singapore +65-87654321

Due to their tabular nature, data in a CSV file can very easily be imported into and stored in an SQL table. The commands to do that, however, are not very well-documented online.

If a CSV file does not open as a text file on your computer, that’s because your computer is opening the file with a spreadsheet program such as Microsoft Excel. In such a case, to see the file as text, you will want to open these files on a text editing software such as Notepad.

Continue reading
Python in XAMPP

Running Python in XAMPP

Are you looking to run Python as a server-side scripting language on your XAMPP installation? Here’s a guide on how to set it up.

Continue reading
Remove the admin bar from the WordPress admin backend

Hiding the WordPress admin bar programmatically on the backend

Whenever you are logged in to WordPress, there is a black admin bar that shows up above every page. On front-end pages, you can call show_admin_bar(false) in one of your plugin or theme functions to remove it. Individual users can also hide the admin bar on their account’s profile page.

All of this, however, doesn’t work if you are on a backend page. No matter what you do, the admin bar will always show up in those circumstances, unless you remove the admin bar programmatically — this article is here to show you how, as well as why you would want to do such a thing.

Continue reading
Pretty Computer Chips
Image by Jonas Svidras at https://stocksnap.io/photo/intel-8008-LBYK1XTHFC.

Passing a variable by value vs. reference

In programming, a concept that usually creates a lot of confusion among those new to it is the concept of passing a variable by value, versus passing a variable by reference. The 2 examples below illustrate the difference between these two ways variables can be passed in Java:

Continue reading
Why doesn't text-align center always work?

Why doesn’t text-align: center work? A primer on block and inline elements in HTML and CSS

If you’re just starting your foray into web development, you’ll probably find that HTML and CSS have a variety of quirks that can make working with them somewhat frustrating for beginners. One of these quirks involves the text-align CSS attribute, as the attribute only applies its effects to certain kinds of HTML elements.

Continue reading
Creating a bar and line graph in Microsoft Word

Creating a bar-line chart in Microsoft Word

Are you tearing your hair out trying to figure out how to create a bar-line chart (i.e. a combination of a bar chart and a line chart) in Microsoft Word? Look no further, we’ve got step-by-step instructions for you in this post, as well as an accompanying video guide.

Continue reading