- Home /
Main Camera problem between two scenes
I have more than two scenes in my project. My input is from kinect. So my problem is, while I skip the scene from one to another, the functions I made to work is not doing. but the gestures are detecting properly. Give some solution to clear it. My code goes below..
public void Start ()
{
GameObject.FindGameObjectsWithTag ("Player");
Clone = PlayerGestureDetection.GetComponent<GestureDetectCollider>();
bg.SetActive (false);
txt.SetActive (false);
prgs_br.SetActive (false);
//CharacterController controller = GetComponent();
}
public void Update()
{
if(Clone.OnOff)
{
StartCoroutine (DisplayLoadingScreen(nxtlvl));
}
}
IEnumerator DisplayLoadingScreen(string lvl)
{
bg.SetActive (true);
txt.SetActive (true);
prgs_br.SetActive (true);
prgs_br.transform.localScale=new Vector3(a, prgs_br.transform.localScale.y, prgs_br.transform.localScale.z);
txt.guiText.text=" Progress " + a + "%";
AsyncOperation async= Application.LoadLevelAsync(nxtlvl);
while(!async.isDone)
{
a=(int)(async.progress * 100);
txt.guiText.text=" Progress " + a +"%";
prgs_br.transform.localScale=new Vector3(a, prgs_br.transform.localScale.y, prgs_br.transform.localScale.z);
yield return null;
}
DestroyImmediate(Camera.main.gameObject);
}
Could you describe the problem in more detail? What is supposed to happen and is not?
Its showing the gesture what I do with the help of GUI text, but the walk is not perfor$$anonymous$$g by the character. The turn is defined in camera. Deponds on camera the character turns. Until i use the loading screen it worked well. After the updation of my progress bar in my project behaving differently.
By this my camera follows.
void LateUpdate()
{
cameraFollowPosition = cameraRotationFull * new Vector3(cameraXOffset, cameraYOffset, -cameraDistanceFromPlayer) + playerTransform.position;
transform.position = cameraFollowPosition;
}
To turn: Turning is working.
if(gesture)
{
//transform.RotateAround(Vector3.up,playerTransform.transform.position,20*Time.deltaTime);
float rotationY = transform.localEulerAngles.y - 2f;
transform.localEulerAngles = new Vector3(xx, rotationY, 0);
cameraRotationFull = Quaternion.Euler(xx, rotationY, 0);
transform.rotation = cameraRotationFull;
}
if(gesture)
{
//transform.RotateAround(Vector3.up,playerTransform.transform.position,20*Time.deltaTime);
float rotationY = transform.localEulerAngles.y + 2f;
transform.localEulerAngles = new Vector3(xx, rotationY, 0);
cameraRotationFull = Quaternion.Euler(xx, rotationY, 0);
transform.rotation = cameraRotationFull;
}
Your answer
Follow this Question
Related Questions
Changing Scenes 1 Answer
How do i remove the gui windows in my scene 1 Answer
How to show live camera on android inside scene??? 1 Answer
how to make my camera follow the character to the scene where my character transported? 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers