So you’re interested in VR development with the Samsung Gear VR. Fortunately, it’s not too difficult to get a build up and running on the Gear VR with Unity. It can, however, be an exercise in patience to figure out the steps to get started. I did some UI development work at Oculus and got accustomed with some of the hoops you need to jump through. I decided to write this guide as an attempt to clarify some of the details.

Please don’t take this guide as the absolute truth. The tools are constantly changing so some stuff may have been correct at some point but wrong at the present. Also, in the future, some things will definitely change. This is only intended as a starting point, a primer. If anything’s wrong, please let me know. There’s a lot to learn!

The Hardware

Here’s a quick rundown of the hardware that you may need and what role they play in development.

Samsung Gear VR

gearvr_consumer
The Samsung Gear VR consumer edition

You probably already know this by now, but the Gear VR is a VR headset in which you plug a specific Samsung phone into and it becomes a standalone VR device. With hardware manufactured by Samsung, and software by Oculus, it was first introduced Fall of 2014 and a few models have been released since then.

There are 3 versions of the Gear VR:

  • First Innovator Edition: Compatible with the Samsung Note 4 phone.
  • Second Innovator Edition: Compatible with the Samsung Galaxy S6 and S6 Edge phones.
  • Gear VR Consumer Edition: Compatible with the Samsung Note 5, the S6, the S6 edge and the S6 edge+ phones.

Continue Reading…

wp8_donutget
Donut Get! running on Windows Phone 8

Earlier this year I jumped into Windows Phone 8 when I got a Nokia Lumia 920. I’d been using an iPhone 3G for about 4 years and was ready to move on to something a bit more… modern. While Windows Phone has its crappiness (you mean I can’t save image attachments from e-mails???), iOS had its fair share of crappiness early on as well (no copy & paste???).

It was great to have a new fancy phone but I had an empty place in my heart because I couldn’t play my Sokay Games on my phone… 🙁

Bless the gurus at Unity for bringing the Windows Phone 8 exporter to Unity 4, and for free as well!

A couple weeks ago I tested out the WP8 exporter by doing a quick port of Donut Get! I got it working within an hour. I still need to polish it for release, but it was surprising how little extra it required me to get it running. In this post I will cover some of the process and the gotchas I encountered along the way.

Continue Reading…

Since using Unity, I’ve been trying to replicate a pipeline that’s similar to Flash. Being able to use Flash’s environment for hand-polished 2d animation just can’t be beat, unless you count custom developed tools. LWF from GREE shows promise in allowing you to bring your Flash animation into Unity, but there is some work involved in getting it to work!

donuts_lwfDemo made with LWF in Unity.

With the mobile version of DONUT GET!, I tried a homemade Sprite Animation approach. This worked reasonably for the requirements of the port but it was more trouble than anticipated given the size of the texture sheets needed for so many frames of animation. Sprite sheets ate up RAM like nobody’s business and easily crashed lower-end devices.

Late last year GREE announced a godsend, LWF. It’s an Open Source tool to export Flash animation from SWF’s into Unity or HTML5. This was around the time I released DONUT GET! on mobile (which was GREE integrated) and I was excited to try it out. Unfortunately, the first release required you to compile it yourself and the only info I could find was in Japanese. Later on I found out that GREE posted more information and a super helpful video walkthrough on the Unity forums.
Continue Reading…

The Demo

Here’s a CSS3 demo of the Donut Get! background.

Use your mouse to adjust the perspective of the scene.

I’ve been messing around with CSS3’s 3D Transform ability recently. I was looking for a way to achieve some primitive 3D visuals strictly with HTML. I wanted something that would also run on phones and tablets.
Continue Reading…



 

We recently released Donut Get! on iPhone and Android. It was originally developed in Flash and we made the mobile ports in Unity. One of the challenges of porting was figuring out how to bring the game’s Flash animation into Unity. Here’s the “quick ‘n dirty” solution I came up with.
Continue Reading…

Ok, I had a hell of a time figuring out how to load in XML for a Unity project I’m working on and use it to build a level. Fortunately the Unity Community is vibrant and helpful, even though you may have to do digging to find what you’re looking for. It can be difficult getting started, especially when working in C# as many of the examples are coded in Javascript.

Here’s an example of some game xml:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<stageData>

<stage>

<map>1, 2, 3, A, B, C</map>

<map>4, 5, 6, 7, 8, 9</map>

<map>2, 1, 3, 5, 6, 2</map>

</stage>

<map>0, 0, 0, 0, 0, 0</map>

<map>1, 1, 1, 1, 1, 1</map>

<map>A, A, A, A, A, A</map>

<map>3, 3, 3, 3, 3, 3</map>

<map>C, C, C, C, C, C</map>

</stage>

</stageData>

Keep in mind that there’s a million ways to go about doing this. I tried to justify why I did it this way, and the best I can say is “I just felt like it.” Haha!

I ended up using a C# port of this Lightweight XML parser. The benefit of it supposedly is that it’s only 8k compared to a megabyte or so that would be added if you used the native C# class, System.XML. I used the C# port by chirhotec in this post. I had to make a small change, commenting out the “string nodeContents” line because the variable wasn’t used.
Continue Reading…

[Check out our Away 3D 4.0 update to this post — Stars and Clouds in Away 3D 4.0]

This is a tutorial based on the simple starfield I created during the loading screen for our recently released game, Rush Hour Plus. I created it in Flash with Away 3D Lite.

This can make a good effect for flying through stars in space, cool particles for action sequences, pixies in an enchanted forest, lotta different things if you put your mind to it!

Here’s the starfield used for the loading screen for Rush Hour Plus .

View the tutorial demo here: http://blog.sokay.net/stuff/starfield/

I wanted to give a little motion to the loading screen with adding too much weight to the filesize (only like 30KB) so I opted for creating this starfield with Away 3D Lite.

Download Away 3D Lite from their repository. Their site has an old version which doesn’t include the Sprite3D class. Get it latest version here:

https://github.com/away3d/away3dlite-core-fp10

And here is the source for the main chunk of it, the StarField class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
public class StarField extends BasicTemplate
{

private var starCount:int = 200;
private var stars:Vector.;

private var starArt:BitmapData; // in this tutorial we'll create a bitmapData from scratch

private var rotateSpeed:int = 1;
private var rotateDirection:String = "none";

public function StarField()
{
mouseChildren = false;
mouseEnabled = false;
}

override protected function onInit():void
{
trace("on init");
debug = false; // setting to false hides debug info in template class

//create bitmapData for our material, 4x4 and white! (0xffffff)
starArt = new BitmapData(4,4,false,0xFFFFFF);

// create an Away3D Material with that bitmapData, this is the image used for our particles!

//var starMaterial:BitmapMaterial = new BitmapMaterial(new starArt().bitmapData); // use this if you decide to import an asset
var starMaterial:BitmapMaterial = new BitmapMaterial(starArt);

// create a Vector array to the size of "starCount"
stars = new Vector.(starCount , true);

// start filling the Vector with Sprite3D objects!
for (var i:int = 0; i &lt; starCount; i++) {

var star:Sprite3D = new Sprite3D();
star.material = starMaterial;
star.width = 4;
star.height = 4;

star.alignmentType = AlignmentType.VIEWPOINT; // I forgot what this does... haha! look it up!

star.x = -400 + (Math.random() * 800);
star.y = -500 + (Math.random() * 800);
star.z = -1000 + (Math.random() * (1000 + 800));

scene.addSprite(star);

stars[i] = star;
}

// offset the stars a bit to make them look pretty like!

//scene.rotationY = 0; // reverse direction
//scene.rotationY = 180; // towards screen

scene.rotationY = 160; // nice dynamic, over the shoulder angle
scene.rotationX = 10;

}

// sets the rotation to look in a certain direction

public function lookForward(): void {
scene.rotationY = 180;
scene.rotationX = 0;
}

public function lookBackward(): void {
scene.rotationY = 0;
scene.rotationX = 0;
}

public function lookLeft(): void {
scene.rotationY = -90;
scene.rotationX = 0;
}

public function lookRight(): void {
scene.rotationY = 90;
scene.rotationX = 0;
}

// set a rotation direction with the keys

public function rotateLeft() : void {
rotateDirection = "left";
}

public function rotateRight() : void {
rotateDirection = "right";
}

public function rotateUp() : void {
rotateDirection = "up";
}

public function rotateDown() : void {
rotateDirection = "down";
}
public function rotateNone() : void {
rotateDirection = "none";
}

// this onPreRender function fires every frame, thanks to our nift Away3d template file!

override protected function onPreRender():void
{

for (var i:int = 0; i &lt; stars.length; i++) {

var star:Sprite3D = stars[i];

star.z += 20; // stars move forward on Z-axis every frame

if (star.z &gt; 800) {
star.z = -1000; // when stars move past limit of 800, set them back to -1000 so they loop forever!
}

}

// handle rotations!
if (rotateDirection == "left") {
scene.rotationY += rotateSpeed;
} else if (rotateDirection == "right") {
scene.rotationY -= rotateSpeed;
}
if (rotateDirection == "up") {
scene.rotationX += rotateSpeed;
} else if (rotateDirection == "down") {
scene.rotationX -= rotateSpeed;
}

}

}

The class uses the Away3D BasicTemplate class, which sets up the view and basic scene super quickly. I believe there’s also a FastTemplate class, but for some reason it doesn’t work with Sprite3Ds so watch out for that! And by default the BasicTemplate has a debug function built in, so you have to switch it off. The BasicTemplate is good for setting up something quick! But I’d rather setup something myself ideally.

It creates 200 Sprite3D objects, which use a white 4×4 square of BitmapData for its texture. Those are then scattered randomly in 3D space and on each frame it pushes them forward 20 units. I added in some keyboard controls so you can mess around with it (arrows and WASD).

Download the source here:

The source can be run from an FLA (CS4 format and AS3) or you can execute it as a Flex Actionscript Project (just make sure to include the lib folder as source, and swc folder).

I hope this helps!

Away3D is a huge improvement over Papervision. I still haven’t done any animated character demos with it but we’ll see if I ever get around to it!

——–
For code styling, I’m using the CodeColorer plugin. Very nifty!