public Object() { this.OwnerID = 0; this._position = new Vector3(0, 0, 0); this.Rotation = new Vector3(0, 0, 0); this.scale = new Vector3(1, 1, 1); this.Direction = new Vector3(0, 0, 0); this.ObjectID = ObjectIDCounter++; this.Collider = new CollisionBox2D(this, Position, new Vector2(0.5f, 0.5f)); }
//public bool IsTouching(CollisionCircle2D other) //{ // //(x2 - x1) ^ 2 + (y1 - y2) ^ 2 <= (r1 + r2) ^ 2 // return Math.Pow(other.Position.x - Position.x, 2) + // Math.Pow(Position.z - other.Position.z, 2) <= // Math.Pow(other.Radius + Radius, 2); // return false; //} public override bool IsTouching(BaseCollider other) { if (other.collisionShape == CollisionShape.Box) { return(CheckCircleToBoxCollision(this, (CollisionBox2D)other)); } else if (other.collisionShape == CollisionShape.Circle) { return(CheckCircleToCircleCollision(this, (CollisionCircle2D)other)); } return(false); }
public void RemoveOldCollisions(BaseCollider other) { this.OldCollisions.Remove(other.ColliderObjectID); }
public bool IsCurrentlyCollidingWith(BaseCollider other) { return(this.CurrentlyCollidingWith.ContainsKey(other.ColliderObjectID)); }
public void AddOldCollision(BaseCollider other) { this.OldCollisions.Add(other.ColliderObjectID, other); }
public void RemoveCurrentlyCollidingWith(BaseCollider other) { this.CurrentlyCollidingWith.Remove(other.ColliderObjectID); }
public void AddCurrentlyColliding(BaseCollider other) { this.CurrentlyCollidingWith.Add(other.ColliderObjectID, other); }
public void RemoveNewCollision(BaseCollider other) { this.NewCollisions.Remove(other.ColliderObjectID); }
public virtual bool IsTouching(BaseCollider otherBox) { return(false); }