unity character controller ignore collision
Collider characterController = GetComponent<CharacterController>();
Collider otherCollider = otherGameObject.GetComponent<Collider>();
Physics.IgnoreCollision(characterController, otherCollider);
unity character controller ignore collision
Collider characterController = GetComponent<CharacterController>();
Collider otherCollider = otherGameObject.GetComponent<Collider>();
Physics.IgnoreCollision(characterController, otherCollider);
unity ignore collision
/*
Makes the collision detection system ignore all collisions between collider1 and
collider2.
Note that IgnoreCollision is not persistent. This means ignore collision state
will not be stored in the editor when saving a scene.
*/
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public Transform bulletPrefab;
void Start()
{
Transform bullet = Instantiate(bulletPrefab) as Transform;
Physics.IgnoreCollision(bullet.GetComponent<Collider>(), GetComponent<Collider>());
}
}
// persistent method: https://docs.unity3d.com/Manual/LayerBasedCollision.html
// alternative: https://docs.unity3d.com/ScriptReference/Physics.IgnoreLayerCollision.html
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us