internal void OnCollisionEnd(SCollisionResult res) { if (isAlive) { foreach (var i in _componentList) { i.Value.OnCollisionEnd(res); } } }
protected override bool GenerateCollisionRes(SICollider other, out SCollisionResult selfres, out SCollisionResult otherres) { if (other.GetType().Equals(typeof(SSphereCollider))) { var minDis = (other.position - position).sqrtMagnitude; if (minDis <= (radius + other.radius) * (radius + other.radius)) { //SDebug.LogWarning(gameObject.name + " BAAAAAANG!!! " + minDis); } } else if (other.GetType().Equals(typeof(SCapsuleCollider))) { var oth = other as SCapsuleCollider; Fix64 minDis = Fix64.MaxValue; var atop = position - oth.positionA; var btop = position - oth.positionB; var ti = atop.Dot(oth.up); var tj = btop.Dot(oth.up); var w = position - oth.positionA; if (ti * tj < Fix64.Zero) { minDis = w.sqrtMagnitude - w.Dot(oth.up) * w.Dot(up); } else if (ti <= Fix64.Zero) { minDis = atop.sqrtMagnitude; } else if (tj >= Fix64.Zero) { minDis = btop.sqrtMagnitude; } if (minDis <= (radius + other.radius) * (radius + other.radius)) { SDebug.LogWarning(gameObject.name + " BAAAAAANG!!! " + minDis); } } selfres = new SCollisionResult(); otherres = new SCollisionResult(); return(false); }
protected void handleResult(SCollisionResult res) { }
protected override bool GenerateCollisionRes(SICollider other, out SCollisionResult selfres, out SCollisionResult otherres) { selfres = new SCollisionResult(); otherres = new SCollisionResult(); return(false); }
protected abstract bool GenerateCollisionRes(SICollider other, out SCollisionResult selfres, out SCollisionResult otherres);
public virtual void OnCollisionEnd(SCollisionResult res) { }
public virtual void OnCollisionStay(SCollisionResult res) { }