i have a player with ‘walk’ ‘idle’ and ‘reverse’ animations assigned. the animations play perfectly when controlling the character, however when i move the character forward witht he ‘w’ key, the animation plays fine but the player grows.
any ideas what is going wrong?
ive attached the images below to better explain -
Is it possible you’re modifying transform.localScale in the code that responds to the input? Can you post the script that is controlling the character?
hi,
here is my character controller script -
var speed = 6.0;
//var jumpSpeed = 8.0;
var gravity = 20.0;
private var moveDirection = Vector3.zero;
private var grounded : boolean = false;
function FixedUpdate() {
if (grounded) {
// We are grounded, so recalculate movedirection directly from axes
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
//if (Input.GetButton ("Jump")) {
//moveDirection.y = jumpSpeed;
//}
}
// Apply gravity
moveDirection.y -= gravity * Time.deltaTime;
// Move the controller
var controller : CharacterController = GetComponent(CharacterController);
var flags = controller.Move(moveDirection * Time.deltaTime);
grounded = (flags CollisionFlags.CollidedBelow) != 0;
}
@script RequireComponent(CharacterController)
any help would be great, i cant figure this out.
ive started from scratch again, and its sorted now