3iX

Reliable $1 Web Hosting by 3iX

Wednesday, May 12, 2010

Play Streaming Video in Unity 3D

Video can be streamed in Unity3D only when it is in ogg or ogv format. To get ogv file

  1. put any video file (mov, avi, mp4 ) inside unity 3d project window. 
  2. Right Click the movie file and choose export ogg file
  3. Save the file in Desktop or some known location
  4. setup your web server both remote and local web server will work fine. I'll go for local web server I'll get and install xampp from apache friends
  5. Copy paste the exported files i.e. the ogv files in the xampp htdocs folder such that it will be accessed from browser as http://localhost/filename.ogv
Now use the following code as cs file to play videos

using UnityEngine;
using System.Collections;

public class streaming : MonoBehaviour {

private MovieTexture  m;
private string playButtonString="play",url= "http://localhost/";
private string [] mediaSource = {"1.ogv","2.ogv","3.ogv","4.ogv","5.ogv"};
public AudioSource AS;
bool isMenu = true;
int tmp;
private WWW www;

// Use this for initialization

void Start () {
 
}
// Update is called once per frame
void Update () {
if(Input.GetKeyUp(KeyCode.Escape))

{
//~ Screen.showCursor = true;
Screen.fullScreen = false;
isMenu = true;
}
if(Screen.fullScreen == true) {
if(Input.mousePosition.x >=20 && Input.mousePosition.x<=(Screen.width -40) && Input.mousePosition.y>=0 && Input.mousePosition.y <= 80)
isMenu = true;
else
isMenu = false;
}
else
isMenu = true;
}
void OnGUI() {
if(m!=null)
GUI.DrawTexture (new Rect (0,0,Screen.width,Screen.height),m,ScaleMode.StretchToFill);
else
GUI.Label(new Rect(50,100,200,50), "Video is yet to Start");
if(isMenu) {
GUI.Box(new Rect(20, Screen.height - 60, Screen.width-40,60),"");
for ( int i=0;i < mediasource.length;i++) {
if(m!=null)
if (i == tmp && m.isPlaying) 
playButtonString="pause"; //it's playing so the button should pause.
else
playButtonString="play"; //it's not playing and the button should play the movie.
if (GUI.Button (new Rect (30 + (200 * i),Screen.height-40,100,30),playButtonString + i) == true)
{
if(m!=null)
if (m.isPlaying == true) {
m.Pause();
AS.Pause();
if (i == tmp)
return;
}
else if(m.isReadyToPlay && i == tmp)
{
m.Play();
AS.Play();
return;
}
www = new WWW(url+mediaSource[i]);
m = www.movie;
AS.clip = m.audioClip;
while(!m.isReadyToPlay) {
SomeCoroutine();
if (!m.isPlaying) {
m.Play();
if(!AS.isPlaying)
AS.Play();
}
}
Screen.fullScreen = true;
isMenu = false;
tmp = i;
}
if (GUI.Button (new Rect(130 + (200 *i),Screen.height-40,100,30),"Stop"+ i)==true && i==tmp) {
m.Stop();
AS.Stop();
}
}
}
else {
GUI.Label( new Rect(Screen.width - 200, 10,200,20), "Press Esc for Menu or");
if(GUI.Button( new Rect(Screen.width - 200, 30,100,20), "Click Here")) {
isMenu = true;
Screen.fullScreen = false;
}
}
}
IEnumerator SomeCoroutine () {
        // Wait for one frame
        yield return www;
      }
}



Tuesday, March 9, 2010

How to create an island terrain in Unity 3D game engine - 2

How to create an island terrain in Unity 3D game engine - 2


PART - 4



Unity 3D - Lesson 1 part 4 from Will Goldstone on Vimeo.


PART - 5



Unity 3D - Lesson 1 part 5 from Will Goldstone on Vimeo.


PART - 6



Unity 3D - Lesson 1 part 6 from Will Goldstone on Vimeo.


PART - 7

Unity 3D - Lesson 1 part 7 from Will Goldstone on Vimeo.

How to create an island terrain in Unity 3D game engine

How to create an island terrain in Unity 3D game engine



In this software tutorial you will learn how to create an island terrain in Unity 3D game engine.
PART 1 covers creating a new project and exploring the interface.
PART 2 covers terrain extrusion and texturing.
PART 3 covers Trees and further environment topography.
PART 4 covers Lighting & First Person Control. In this part we introduce the First Person Controller, a ready made prefab allowing you to walk around using the keys and mouse, and lighting the scene.
PART 5 covers Water Elements and Light Flares.
Part 6 covers using a particle system to add smoke to our volcano.
PArt 7, the final part covers improving our volcano's particle system by creating a material for the smoke.
This tutorial series is a great way to learn how to create an entire terrain from start to finish including effects and lighting in Unity 3D and is a grea lesson to learn how to use the Unity 3D game engine software.

PART 1

Unity 3D - Lesson 1 Part 1

PART 2



Unity 3D - Lesson 1 part 2 from Will Goldstone on Vimeo.

PART 3



Unity 3D - Lesson 1 part 3 from Will Goldstone on Vimeo.



Friday, February 26, 2010

Symbian OS Quick Start

2.1 What Do You Need to Get Started?
The following are needed for developing Symbian OS smartphone software:
• A PC running Windows XP, 2000, or Vista (at least 1.5 GHz, 512MB
RAM, and 2 GB free disk space is recommended).
• The C++ SDK for your smartphone model.
• A Windows development package (Win32 development tools with
an Integrated Development Environment (IDE); Carbide.c++ is recommended).
• A Symbian OS smartphone.
• The PC suite used for communication between the PC and the
smartphone.
2.1.1 Build Tools Overview
Figure 2.1 shows the basic development pieces. Symbian OS software is
developed and built on a host PC. You can build your software to run on the Symbian OS PC-based emulator that comes with the SDK, or you can
build for the smartphone itself and load your program to the phone via
the PC suite through USB, IR, or Bluetooth technology.
Once your application is completed, it’s deployed to users as an
installation file, known as a SIS file. The user can download this SIS file
from a PC to a smartphone using their PC connection suite. Alternatively,
they can retrieve it to the smartphone itself by downloading it from
a WAP site or a website, or receiving it as an email attachment or
Bluetooth message, or saving it to a removable memory card, using a PC
with appropriate card writer, then putting the card into the phone and
installing from there.

2.1.2 What is the Symbian OS Emulator?
The emulator is a Windows application that simulates a smartphone
entirely on the PC – complete with functional buttons and small screen
display. This allows you to run and debug Symbian OS software on your
PC as opposed to running on a real device. Why do this?
• You avoid having to upload your code to the smartphone for each
code/compile/debug iteration.
• You can take advantage of the debugging support available from the
Windows IDE, which includes single stepping and watch points.
• You can experiment with smartphone development on various platforms
without having to buy or borrow the smartphones for those
platforms.
The emulator simulates the actual smartphone fairly well, with some
differences that I will discuss in more detail in Chapter 5. Each SDK has
its own emulator to mimic the smartphone type that it is targeted for.
You can even change the display resolution and orientation to match the
various display modes of the target device so you can test your software
in each of these modes.