public override void CheckCollision(ColliderCustom c) { Vector3[][] faces = this.GetFaces(); foreach (Vector3[] face in faces) { if (c is BoxColliderCustom && ((BoxColliderCustom)c).CheckFace(face)) { if (this.Stop) { this.GetComponent <RigidbodyCustom>().StopMovement(); } } } }
public override void CheckCollision(ColliderCustom c) { if (c is BoxColliderCustom) { List <Vector3> collisions = this.GetCollisionPoints(((BoxColliderCustom)c).GetAllPoints()); if (collisions.Count > 0) { if (this.Bounce) { Vector3[] face = ((BoxColliderCustom)c).GetFace(collisions); Vector3 normale = ((BoxColliderCustom)c).GetNormal(face); if (normale == Vector3.zero) { normale = new Vector3(0f, 1f, 0f); } this.GetComponent <RigidbodyCustom>().BounceMovement(this.BounceCoefficient, normale); } } } }
public abstract void CheckCollision(ColliderCustom c);