Okay so I’m having trouble with this movement script. I’m a super beginner (actually I know nothing of scripting at all, and I got this from the Tornado Twins).
var speed : float = 3;
var rotateSpeed : float = 3;
function Update() {
var controller : CharacterController = GetComponent( CharacterController );
transform.Rotate( 0, Input.GetAxis( "Horizontal" ) * rotateSpeed, 0 );
var forward = transform.TransformDirection( Vector3.forward );
var curSpeed = speed * Input.GetAxis( "Vertical" );
controller.SimpleMove( forward * curSpeed );
}
@script RequireComponent( CharacterController );
For some reason my character spins like a clock, instead of around the Y axis. Thanks for the help!
-Rov
Well if that’s the only script that affects your player it’s obviously that Input.GetAxis( "Horizontal")
is returning a value != 0.
So you should check your InputManager how the virtual axis is defined. Watchout, an axis can appear multiple times for example one time with keys like “a” and “d” a second time with “left arrow” and “right arrow” and maybe another one for a joystick or something else.
Well this is very helpful if you want to learn scripting in java, boo or C#.
http://unity3d.com/support/documentation/ScriptReference/
Have a look at this and make sure you closely study the scripts and see how they are made and what each function does. This site helped me alot when I first started out in unity.
I figured out it wasn’t a problem with the script. Thanks for your help!
-Rov