Hello…
I’m building my own character motor script, to learn more unityscript, and because i want to arrange all my character sound and animation in the same script…
actually i have a problem, i can move the player according the camera position, but can’t rotate player to the current axis…
please, look at this webplayer to understand what is my problem:
http://dl.dropbox.com/u/15814398/MotorTest/WebPlayer.html
(file is uploading, it can take a while).
and here is my script :
function Update () {
InputMovement();
}
function InputMovement () {
var controller : CharacterController = GetComponent(CharacterController);
var cam : Transform = Camera.main.transform;
var right : Vector3 = cam.TransformDirection(Vector3.right);
var forward : Vector3 = cam.TransformDirection(Vector3.forward);
controller.SimpleMove(forward * 3 * Input.GetAxis("Vertical"));
controller.SimpleMove(right * 3 * Input.GetAxis("Horizontal"));
}
as you can see, my problem is in the Horizontal Axis, my player won’t to rotate to left or right if i press horizontal axis, it continues looking forward… what do i’m missing?.. … I don’t want to smooth the change of look at of my player, does not matter if turns left, right, back or forward brusquely…
Thank you.