Authormohan.rao

How to play movie in iphone using unity3d

H

this is code used to play the video in iphone using unity 3d using UnityEngine; using System.Collections; public class IntroMovie : MonoBehaviour { void Start ()  { iPhoneUtils.PlayMovie(“CINEMATIC_WITH_MUSIC.mp4”,Color.black, iPhoneMovieControlMode.CancelOnTouch,iPhoneMovieScalingMode.AspectFit);   } } one important thing in order to play video files it should be placed in...

Screen Orientations Methods in unity3d

S

There are 3 types of orientation in Rotate only landscape public void AutoOrientToLandScape() { if(Vector3.Dot(Input.acceleration.normalized,new Vector3(1,0,0)) > 0.45)  { Screen.orientation=ScreenOrientation.LandscapeRight; } else if(Vector3.Dot(Input.acceleration.normalized,new Vector3(-1,0,0)) > 0.45)  { Screen.orientation=ScreenOrientation.LandscapeLeft; } } Rotate only Portrait public...

How to add an audio file to a button in Unity3D

H

using UnityEngine; using System.Collections; using System; public class MainMenu : MonoBehaviour { public AudioSource audioSource; public AudioClip palySound; void Start ()  { } public void OnGUI() {  if(GUI.Button(new Rect(50,200,100,45),”Play”))  { audioSource.PlayOneShot(palySound); } }} when we attached the script in the inspector. we have to attach the AudioSource  from the...

How to Create Write and Read a file in iphone without using playerprefs in unity3d

H

it is not that easy to read or write file in iphone we have to give the specific path in order to read or write. here is the sample code using UnityEngine; using System.Collections; using System.IO; using System.Text; public static class GameManager { private static string path; public static void starting () { path = Application.dataPath.Substring (0, Application.dataPath.Length - 20...

How to make an AI Enemy Car in which it follows the track during the Race ?

H

The AI for enemy car can be done by using waypoints method.. the following code is used var waypoint : Transform[]; var speed : float =20; private var currentWaypoint : int; var loop : boolean = true; function Awake() {waypoint[0]=transform;} function Update () { if(currentWaypoint < waypoint.Length) { var target : Vector3 = waypoint[currentWaypoint].position; var moveDirection : Vector3 =...

Weird movment of character in Unity3D

W

Question:I imported a simple 3d model from which I construtected a terain. For a test I use box(mesh), but movment is really weird like that models would be realy bumpy. Because of that I also tryed to switch my models with unity meshes but it’s same   Answer:In ur game select cube in that u have added rigidbody. In Rigidbody select the constraints in that u will see freeze rotation...

Movement from Unity 3d into Unity 3D iOS or Android

M

if u want to using buttons use this it will work in unity 3d and ios void OnGUI() { if(GUI.RepeatButton(new Rect(50,210,40,40),"up")) { transform.Translate(Vector3.forward*Time.deltaTime*50); } if(GUI.RepeatButton(new Rect(50,280,40,40),"down")) { transform.Translate(Vector3.back*Time.deltaTime*50); } if(GUI.RepeatButton(new Rect(10,250,40,40),"left")) { transform.Rotate(Vector3.down, 90*Time...

Category