Increase Scene Speed

Hi!
I’ve added an First Person Controller to my Scene. If I press W,A,S or D keys, my scene is moving very slow. What to do to increase my scene speed?

on the first person controller look for the fpswalker script and set your speed higher.
it’s not the scene thats slow but the controller.

Hi!
I’ve set the speed variable to 60.0. Its original value is 6.0. Now also movement is slow(No change at all).It runs as it was before.

where did you change it ? in the script or the inspector ?

In the script.

you need to change it in the inspector, that has priority over the script if your speed variable is a simple var.

Thanks. It’s working now. I need help on another topic also. I’ve added point light to the scene. I’ve to make the light on or off, if a key is pressed(e.g if “O” is pressed, the light has to toggle between Glow or Off). How to do this?

var myLight : GameObject;
var isOn : boolean = true;

function Update () {
if (Input.GetKeyDown(KeyCode.O) isOn == true) {
myLight.active = false;
isOn = false;
}
if (Input.GetKeyDown(KeyCode.O) isOn == false) {
myLight.active = true;
isOn = true;
}
}
this is untested but i think thats it
make sure you drag drop your light onto the myLight var in the inspector

Untested…

var myLight : GameObject; 

function Update () { 

if (Input.GetKeyDown(KeyCode.O)) { 
myLight.enabled = !myLight.enabled;
} 

}

yep, less code also works:

var myLight : GameObject; 

function Update () { 
	if (Input.GetKeyDown(KeyCode.O)) { 
	myLight.active = !myLight.active;
	}
}

[/code]

Hi!
Thanks. I added the Java Script file to the “\Assets\Standard Assets\Scripts” path. But it didn’t appear in the Component->Scripts Menu. Only six scripts (default ones) were there. Where else to add?

drag and drop your script on to the main camera in the hierarchy.
also drag your light on the myLight var in the inspector

If I drag and drop my Script to Main Camera, I got the following error:

Can’t add Script behaviour Light Toggle. The scripts file name does not match the name of the class defined in the script!

This is your code as entered by me:

var myLight : GameObject; 
var isOn : boolean = true;

function Update () {
if (Input.GetKeyDown(KeyCode.O)  isOn == true) { 
myLight.active = false; 
} 
if (Input.GetKeyDown(KeyCode.O)  isOn == false) { 
myLight.active = true; 
}
}

What to do?

did you create a java script or a csharp ? it has to be a java
also use this script, it’s easier to manage:

var myLight : GameObject; 

function Update () { 
   if (Input.GetKeyDown(KeyCode.O)) { 
   myLight.active = !myLight.active; 
   } 
}

Thank u very much. It works now.