2D Toolkit Forum

2D Toolkit => Support => Topic started by: JBabz on July 29, 2013, 01:12:12 am

Title: [FIXED] [2.1] Collision Breaks?
Post 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?

Code: [Select]
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));
}
}
Title: Re: [2.1 BETA] Collision Breaks?
Post by: unikronsoftware on July 29, 2013, 11:30:23 am
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.
Title: Re: [2.1 BETA] Collision Breaks?
Post by: JBabz on July 30, 2013, 05:32:48 pm
How do I make the wall "thicker"? :/
Title: Re: [2.1 BETA] Collision Breaks?
Post by: unikronsoftware on July 30, 2013, 05:36:35 pm
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.
Title: Re: [2.1 BETA] Collision Breaks?
Post by: JBabz on July 30, 2013, 05:39:51 pm
Beautiful! This is honestly the most well-supported software I've ever used. :)
Title: Re: [FIXED] [2.1] Collision Breaks?
Post by: robmpreston on August 04, 2013, 04:14:17 am
Glad I used the search feature. Was having this exact same issue, changing the collider depth fixed it straight away! Thanks!