"2code" Posts

Understanding Spherecasts in Unity


SphereCast and all related pages are confusing.

The easiest way for me to describe Spherecasts in the shortest terms possible is to post my bug report:


JS to C# converter


This is a link to a page on the M2H Game Studios‘ site that converts UnityScript/Unity.js to C# converter:


This is very convenient site.

You can paste your Unity JavaScript (UnityScript) code into the top box on the page, hit process, and get the C# out the bottom!


Basic Inventory and Looting System


I’ve been looking through the Unity3D forums for information and answers about creating a basic inventory system. The analogy that I was trying to work towards was a system more akin to Worlds of Warcraft, where the player is looting objects such as chests or dead opponents rather than picking up objects from the ground, and discarding objects would simply destroy the item rather than “drop” the item back  into the game as a newly instantiated GameObject.

From my search, three threads stood out:

http://forum.unity3d.com/viewtopic.php?t=11865    Der Dude

http://forum.unity3d.com/viewtopic.php?t=46222    Alexwilds

http://forum.unity3d.com/viewtopic.php?t=51475    stneas

All three of these systems deserve your time and analysis as they all have different approaches to creating an inventory system. (more…)

Simple iPhone Calibration


For Moonbase: Lander I needed a way to calibrate the starting or neutral position of the device in a manner that could be stored and re-used during game play.

I looked on the Unity3D forums, and found this thread:


… where Sandoze, from Fuel Games posted their solution.


I converted this from C# to Unity.js, and later modified it with the help of Neil Carter (NCarter) on the #unity3d irc channel.

And this is what I finally came up with: