Author Archives: onuroral

iTween Code (C#)

Path1 defines the all selected coordinates (x,y,z) and path for one object. This means I have to define more than one path for my every different object. In the example, the object’s path is named Path1.

Also the name Tester is the name of the code file. The name Tester should be different for every different paths (Tester1, Tester2, or any other…)

using UnityEngine;
using System.Collections;

public class Tester : MonoBehaviour
{
void Start () {
iTween.MoveTo(gameObject, iTween.Hash(“path”, iTweenPath.GetPath(“Path1”), “time”, 5));
}
}

3D Page

This is the first scene, before an user floats into the page. Every object seems flat at the first time.

This is the floating scene. The scene that an user floats into the page freely with both keyboard (W,A,S,D) and mouse.

Transforming the Camera

This code will make users to be able to start the floating again from the beginning. The camera (the view of the user) transforms to its original/starting position.

To do this with Unity3d, I created an empty object, named SpawnPoint, arrange its position the same with the camera’s original position so that after pressing the button it goes back to its original position.

var SpawnPoint : Transform;

function Update () {

if(Input.GetButton(“Jump”)) // Jump is the name of the button
{
transform.position = SpawnPoint.position;
}
}

 

This is the code that I found on the Internet. It also works the same way, but my guess, this code is for games. I did not research GUI enough yet. After I did that, I will decide which one works best for my project.

function OnGUI () {

if (Event.current.Equals (Event.KeyboardEvent (“positivebuttonname“))) Application.LoadLevel(Application.loadedLevel);

}