gg/collider.go

34 lines
787 B
Go
Raw Normal View History

2023-10-23 15:45:18 +03:00
package gg
// Implementing the interface lets
// the engine to work faster about
// collisions because it first checks
// if the the bigger collider that
2023-12-14 22:01:07 +03:00
// contains more complicated (accurate) structure
// do collide.
type ColliderSimplifier interface {
2023-05-22 23:39:01 +03:00
ColliderSimplify() Triangle
}
// The structure represents all
2023-05-22 23:39:01 +03:00
// information on collisions.
type Collision struct {
2023-05-22 23:39:01 +03:00
Current, With any
}
2023-12-14 22:01:07 +03:00
type PointContainer interface {
ContainsPoint(Point) bool
}
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.
// The Collide method will be called on collisions.
type Collider interface {
Collides(Collider) *Collision
Collide(*Collision)
}
2023-05-22 23:39:01 +03:00