Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Enable/Disable Colliders

Discussion in 'Scripting' started by purplexis, Oct 13, 2006.

  1. purplexis

    purplexis

    Joined:
    Jan 29, 2006
    Posts:
    71
    Is there any way to dynamically turn on and off a collider using scripts?

    I want an object to be able to fall through the character, but then stop when it hits the floor.

    collider.active shuts down the entire object since its turning the gameObject on and off.

    Is there something specific to control just the collider?
     
  2. purplexis

    purplexis

    Joined:
    Jan 29, 2006
    Posts:
    71
    Or better yet - simply have a collider ignore specific colliders.

    That'd be cool to know how to do (if possible) as well.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
  4. purplexis

    purplexis

    Joined:
    Jan 29, 2006
    Posts:
    71
  5. purplexis

    purplexis

    Joined:
    Jan 29, 2006
    Posts:
    71
    Little problem:

    Physics.IgnoreCollision does not seem to see a CharacterController as a collider.

    this is my code:

    var character : Transform;
    var plane : Transform;

    function Update()
    {
    Physics.IgnoreCollision(character.collider, collider);
    Physics.IgnoreCollision(plane.collider, collider);
    }


    Any idea what the problem is? Anyone?
     
  6. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    IgnoreCollision currently doesn't work for character controllers.
     
  7. purplexis

    purplexis

    Joined:
    Jan 29, 2006
    Posts:
    71
    Ahh. Ok.