Character Controller

I’ve started experimenting with this script from the iPhone Standard Assets. It doesn’t seem to react, “normally” though. When the game object collides with a surface, it tends to “stick”, and get get caught in the other game objects collider. I would like it react to the other colliders normally, like push for example. I’m not sure what to change in the script, so any ideas would be greatly appreciated!

can you show pictures so we can understand better?

Check the step value of your character controller. A small valuer will require lots of force to got through a higher place ( stairs for example ).

I’ll try adjusting the step settings. Here’s some screenshots of my issues.

The character gets caught on edges mostly. Gravity should be pulling it down slopes and slants like with other colliders, but gravity doesn’t seem to effect this at all.

192965--6864--$pic2_242.jpg
192965--6865--$pic1_156.jpg

are you applying the caracter controller Gravity as the manual shows on the examples?

Instead of CharacterController.Move(); Try CharacterController.SimpleMove(); ITs move + its also aplies gravity when moving :wink:
If your not moving you will have to pass a Vector.Zero to keep the gravity working on your character controller.
Happy coding ! xD

I’m pretty sure Vector3.Zero is being passed. Here’s the script that I’m using, taken directly from the Standard Assets folder.

var moveTouchPad : Joystick;
var jumpTouchPad : Joystick;

var forwardSpeed : float = 4;
var backwardSpeed : float = 4;
var jumpSpeed : float = 16;
var inAirMultiplier : float = 0.25;					// Limiter for ground speed while jumping

private var thisTransform : Transform;
private var character : CharacterController;
private var velocity : Vector3;						// Used for continuing momentum while in air
private var canJump = true;

function Start()
{
	
	
	// Cache component lookup at startup instead of doing this every frame		
	thisTransform = GetComponent( Transform );
	character = GetComponent( CharacterController );	

	// Move the character to the correct start position in the level, if one exists
	var spawn = GameObject.Find( "PlayerSpawn" );
	if ( spawn )
		thisTransform.position = spawn.transform.position;
}

function OnEndGame()
{
	// Disable joystick when the game ends	
	moveTouchPad.Disable();	
	jumpTouchPad.Disable();	

	// Don't allow any more control changes when the game ends
	this.enabled = false;
}

function Update()
{
	var movement = Vector3.zero;

	// Apply movement from move joystick
	if ( moveTouchPad.position.x > 0 )
		movement = Vector3.right * forwardSpeed * moveTouchPad.position.x;
	else
		movement = Vector3.right * backwardSpeed * moveTouchPad.position.x;
	
	// Check for jump
	if ( character.isGrounded )
	{		
		var jump = false;
		var touchPad = jumpTouchPad;
			
		if ( !touchPad.IsFingerDown() )
			canJump = true;
		
	 	if ( canJump  touchPad.IsFingerDown() )
	 	{
			jump = true;
			canJump = false;
	 	}	
		
		if ( jump )
		{
			// Apply the current movement to launch velocity		
			velocity = character.velocity;
			velocity.y = jumpSpeed;	
		}
	}
	else
	{			
		// Apply gravity to our velocity to diminish it over time
		velocity.y += Physics.gravity.y * Time.deltaTime;
				
		// Adjust additional movement while in-air
		movement.x *= inAirMultiplier;
//		movement.z *= inAirMultiplier;
	}
		
	movement += velocity;	
	movement += Physics.gravity;
	movement *= Time.deltaTime;
	
	// Actually move the character	
	character.Move( movement );
	//velocity.y += Physics.gravity.y * Time.deltaTime;
	
	if ( character.isGrounded )
		// Remove any persistent velocity after landing	
		velocity = Vector3.zero;
}

There’s so much going on in there I’m kinda lost :roll: (Still relatively new to coding.)