2023-05-11 12:28:34 +03:00
|
|
|
package gx
|
|
|
|
|
|
|
|
// Implementing the interface lets
|
|
|
|
// the engine to work faster about
|
|
|
|
// collisions because it first checks
|
|
|
|
// if the the bigger collider that
|
|
|
|
// contain more complicated structure
|
|
|
|
// do collide.
|
|
|
|
type ColliderSimplifier interface {
|
2023-05-22 23:39:01 +03:00
|
|
|
ColliderSimplify() Triangle
|
2023-05-11 12:28:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// The structure represents all
|
2023-05-22 23:39:01 +03:00
|
|
|
// information on collisions.
|
2023-05-11 12:28:34 +03:00
|
|
|
type Collision struct {
|
2023-05-22 23:39:01 +03:00
|
|
|
Current, With any
|
2023-05-11 12:28:34 +03:00
|
|
|
}
|
|
|
|
|
2023-05-22 23:39:01 +03:00
|
|
|
// Implementing the interface lets the engine
|
|
|
|
// to determine if the object collides with anything.
|
|
|
|
// Mostly will use the Collide function with some
|
|
|
|
// inner structure field as first argument.
|
2023-05-11 12:28:34 +03:00
|
|
|
type Collider interface {
|
|
|
|
Collides(Collider) *Collision
|
|
|
|
}
|
|
|
|
|
|
|
|
// happening collision getting the Collision as
|
|
|
|
// argument.
|
|
|
|
type CollideEventer interface {
|
|
|
|
Collide(*Collision)
|
|
|
|
}
|
|
|
|
|
2023-05-22 23:39:01 +03:00
|
|
|
// Single function for all collision to remove
|
|
|
|
// functionality duplicating from the archtecture.
|
|
|
|
// Returns the collision if there is and nil if there
|
|
|
|
// is no collision.
|
|
|
|
/*func Collide(c1, c2 any) bool {
|
|
|
|
}
|
|
|
|
|
|
|
|
func triangleCollidesPoint(t Triangle, p Point) *Collision {
|
|
|
|
}
|
|
|
|
|
|
|
|
func triangleCollidesTriangle(t1, t2 Triangle) *Collision
|
|
|
|
*/
|
|
|
|
|