2D Toolkit Forum
2D Toolkit => Support => Topic started by: JBabz on July 29, 2013, 01:12:12 am
-
My character, if I move towards a mesh collider (wall) long enough, sort of just "breaks through". As if he pushed hard enough that collision breaks. lol. frustrating. why does this happen?
using UnityEngine;
using System.Collections;
public class DungeonPlayerBehaviorScript : MonoBehaviour {
private const float VELOCITY = .075f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
CharacterController controller = GetComponent<CharacterController>();
controller.Move(new Vector3(Input.GetAxis ("Horizontal") * VELOCITY, 0, Input.GetAxis ("Vertical") * VELOCITY));
}
}
-
1. Make sure the wall is taller and thicker than the player.
2. If that still happens - you're either moving too fast (depends on the scale of everything in the world). The world also could be too small in comparison - 20 pixels per meter usually works pretty well for me.
-
How do I make the wall "thicker"? :/
-
Open up the sprite collection editor, in settings you'll see Collider Depth. Increase that and commit. That should be it, your colliders should be thicker.
-
Beautiful! This is honestly the most well-supported software I've ever used. :)
-
Glad I used the search feature. Was having this exact same issue, changing the collider depth fixed it straight away! Thanks!