Archive for the ‘Programming’ Category

Unity3D: Troubleshooting Rigidbody problems

Click here to read Unity3D: Troubleshooting Rigidbody problems

Maybe the component that give Unity3D developers the most number of headaches is the Rigidbody. Sometimes it doesn’t seem to not work the way it’s supposed to, although these problems are mostly caused by wrong parameter values and settings. That’s the main reason behind this post: to point out the most common problems encountered when using rigidbodies in Unity3D.

Before listing these problems, keep in mind that the Rigidbody is part of the physics simulation in Unity3D which is decoupled from the game logic, and that’s why there is a separated Physics Time Step and a different method dedicated to it- the FixedUpdate() method. And before trying to figure out what the problem is, check the basics and see if all GameObjects the Rigidbody collides with have an attached Collider component, or if some parameter is set too high or too low.

Continue reading: “Unity3D: Troubleshooting Rigidbody problems”

Game Programming Basics: Moving an element

Click here to read Game Programming Basics: Moving an element

This post explains some of the most basic game programming techniques: how to move elements on the screen. If you already know this, please skip it, or add something to this post in the comments. Since these lines of codes are trivial to game programming, it may be one of the reasons why it is so hard to find a post or a website explaining them. The code presented on this post isn’t the only way to move objects in a game and certainly there is a lot more information out there. The intention of this post is to serve as a starting point.

Continue reading: “Game Programming Basics: Moving an element”

Unity3D: JavaScript vs. C# – Part 5

Click here to read Unity3D: JavaScript vs. C# – Part 5

As the end of the year draws close, so is this post series. Here, the differences between JavaScript and C# when casting a ray in Unity3D will be pointed out. Don’t forget to read the first, second, third and forth parts of the series for a better general understanding of what is being discussed here.

Let’s start from the basics: What is ray casting? As the name describes, it is basically a program that simulates a ray being cast, much like a laser pointer in real life. It is very useful for game programming, as Raycast classes are programmed to return the distance a ray collided with something (and sometimes, even the name of the object). Unity3D doesn’t have one single Raycast class, instead its functionality is scattered across the Physics, RaycastHit and Ray classes.

Continue reading: “Unity3D: JavaScript vs. C# – Part 5”

Unity3D: JavaScript->C# or C#->JavaScript access

Click here to read Unity3D: JavaScript->C# or C#->JavaScript access

When programming for Unity3D, there are some cases where we need to access a script written in another programming language that isn’t the one we are currently using. Although it is highly recommended to convert all scripts to the same one, it is useful to know how to access a C# script from a JavaScript class and the other way around.

The first thing to do is place the scripts in the correct folders in your Project tab. The script you want to have access must be inside the Standard Assets or the Plugins folder. The other script has to be placed outside these folders. After this step, just call the GetComponent() method as any other Component. Here’s a JavaScript example: Continue reading: “Unity3D: JavaScript->C# or C#->JavaScript access”

Android Manifest File for a Game

Click here to read Android Manifest File for a Game

Android was designed to see every application as a collection of Activities united by intents. It also relies on the Activity stack to determine what Activity will be launched after the user finishes it by pressing the ‘back’ button. While the stack system is helpful for users and for some applications, this default behavior isn’t a necessarily a good thing for games.

That is mainly because of two things: a game use a lot of hardware resources from the device that runs it, meaning that having other activities in the same stack as the game Activity can have an impact on its performance. And the stack default behavior could lead to multiple instances of the same game running in the same stack.

Continue reading: “Android Manifest File for a Game”