My character isn’t colliding with objects head on he just walks right through them. If he jumps and lands on them the collision works great he can sit on top of any cube I create it’s just when he hits them head on walking forward or backward. The only thing I can think of is how I am moving the controller maybe? Code and controller settings below, any ideas?
Character Controller Settings: Slope Limit = 45, Step Offset = .3, Skin Width = .08, Min Move Distance = 0
var walkSpeed : float = 5.0;
var jump : float = 5.0;
var gravity : float = 9.8;
var player : GameObject;
var runSpeed : float = 8.0;
private var jumpNumber : int = 0;
private var moveDirection = Vector3.zero;
private var speed : float = 5.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
// Adds Gravity
moveDirection.y -= gravity * Time.deltaTime;
// Move the controller
controller.Move(moveDirection * Time.deltaTime);
//Walk Right
if(Input.GetButton("MoveRight"))
{
//animation["Walk"].speed = 1.5;
transform.Translate(Vector3.right * Time.deltaTime * speed);
}
//Walk Left
if(Input.GetButton("MoveLeft"))
{
transform.Translate(Vector3.left * Time.deltaTime * speed);
}
//Double Jump
if(controller.isGrounded)
{
jumpNumber = 0;
}
if(Input.GetButtonDown("Jump") && jumpNumber < 2)
{
moveDirection.y= jump;
jumpNumber ++;
}
//Reset on Death
if(player.transform.position.y <= -20)
{
Application.LoadLevel("Squish");
}
//Sprint Function
if(Input.GetButtonDown("Run") && controller.isGrounded)
{
speed = runSpeed;
}
//Sprint Function Release
if(Input.GetButtonUp("Run"))
{
speed = walkSpeed;
}
}