Uni2D Colliders, Character Controller and a Movement Script... Not working...

hi there…

i tried to create a 2D RPG styled Game. Therefor, i created a flat map with Uni2D, and it´s physic colliders.

Everything works fine… if i add a sphere with a rigidbody… it collides with the Uni2D Walls.
Now i tried to add a small movement script to the Sphere.

this is it:

using UnityEngine;
using System.Collections;

public class Character_Controller : MonoBehaviour {
	
	//first the publics
	public GameObject Player;
	public GameObject SpriteHolder;
	
	public float MoveSpeed = 2.0f;
	
	
	// now the locals
	int MoveDirection;
	
	float translationH;
	float translationV;
	
	// now the functions
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		float translationH = Input.GetAxis("Horizontal") * (MoveSpeed/10);
		float translationV = Input.GetAxis("Vertical") * (MoveSpeed/10);
		
		Player.transform.Translate(translationH, -0.001f, translationV);
		Player.transform.eulerAngles = new Vector3(0, 0, 0);
	}
}

What happens is, that the sphere tries to climp over the colliders, floats around a bit (like rolling out) and behaves more like it´s moving on ice ._.

So i searched via Google… and found out that i need to use the Character Controller instead of a rigidbody. Read-Done… CC added…

But now, the object is not reacting to the colliders… like there are no invisible walls ._.

see:
http://www.imagesload.net/img/Unity_Prob01.png
http://www.imagesload.net/img/Unity_Prob02.png

What have i made wrong?

Hi, as far as I understand it (being a noob myself) your object will work properly with colliders only if you use character movement script that goes together with the controller. If you’re using a custom one - you need to script those collider interactions yourself.

Hope this helps :slight_smile: