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-08-31 11:29:37 +03:00
|
|
|
// The Collide method will be called on collisions.
|
2023-05-11 12:28:34 +03:00
|
|
|
type Collider interface {
|
|
|
|
Collides(Collider) *Collision
|
|
|
|
Collide(*Collision)
|
|
|
|
}
|
|
|
|
|
2023-05-22 23:39:01 +03:00
|
|
|
|