So I was following the Penelope tutorial to see how they did their joystick, I went through the tutorial and got to the point where I finished this script, I’m trying to use it in my own project but even when I set speed to like 1 it still moves way to fast, I even tried setting it to like 0.001 and it made no difference. Help?? Thanks.
@script RequireComponent( CharacterController )
var moveJoystick : Joystick;
var rotateJoystick : Joystick;
var cameraTransform : Transform;
var speed : float = 1;
var cameraPivot : Transform;
var rotationSpeed : Vector2 = Vector2(2, 1);
private var thisTransform : Transform;
private var character : CharacterController;
function Start(){ thisTransform = GetComponent( Transform );
character = GetComponent( CharacterController );
}
/*function FaceMovementDirection(){
var horizontalVelocity : Vector3 = character.velocity;
horizontalVelocity.y = 0;
if (horizontalVelocity.magnitude > 0.1){
thisTransform.forward = horizontalVelocity.normalized;
}
}
*/
function Update(){
var movement = cameraTransform.TransformDirection(Vector3(moveJoystick.position.x, 0, moveJoystick.position.y));
movement.Normalize();
var absJoyPos = Vector2(Mathf.Abs(moveJoystick.position.x), Mathf.Abs(moveJoystick.position.y));
movement *= speed + ((absJoyPos.x > absJoyPos.y) ? absJoyPos.x : absJoyPos.y);
movement *= Time.deltaTime;
character.Move(movement);
//FaceMovementDirection();
var camRotation = rotateJoystick.position;
camRotation.x *= rotationSpeed.x;
camRotation.y *= rotationSpeed.y * -1;
camRotation *= Time.deltaTime;
cameraPivot.Rotate(0, camRotation.x, 0, Space.World);
cameraPivot.Rotate(camRotation.y, 0, 0);
}