Hello Guest

Author Topic: [FIXED] [2.1] Collision Breaks?  (Read 5438 times)

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
[FIXED] [2.1] Collision Breaks?
« 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));
}
}
« Last Edit: July 30, 2013, 05:40:03 pm by JBabz »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [2.1 BETA] Collision Breaks?
« Reply #1 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.

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
Re: [2.1 BETA] Collision Breaks?
« Reply #2 on: July 30, 2013, 05:32:48 pm »
How do I make the wall "thicker"? :/

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [2.1 BETA] Collision Breaks?
« Reply #3 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.

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
Re: [2.1 BETA] Collision Breaks?
« Reply #4 on: July 30, 2013, 05:39:51 pm »
Beautiful! This is honestly the most well-supported software I've ever used. :)

robmpreston

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [FIXED] [2.1] Collision Breaks?
« Reply #5 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!