Esempio n. 1
0
func (space *Space) SpacePointQuery(point vect.Vect, layers Layer, group Group, checkSensors bool) (shapes []*Shape) {

	pointFunc := func(a, b Indexable) {
		shapeB := b.Shape()
		shapeA := a.Shape()
		if !queryRejectShapes(shapeA, shapeB) {
			if !checkSensors && shapeB.IsSensor {
				return
			}
			contacts := space.PullContactBuffer()
			numContacts := Collide(contacts, shapeA, shapeB)
			if numContacts <= 0 {
				space.PushContactBuffer(contacts)
				return
			}
			shapes = append(shapes, shapeB)
		}
	}

	dot := NewCircle(vect.Vector_Zero, 0.5)
	dot.BB = dot.update(transform.NewTransform(point, 0))
	dot.Layer = layers
	dot.Group = group
	space.staticShapes.Query(dot, dot.AABB(), pointFunc)
	space.activeShapes.Query(dot, dot.AABB(), pointFunc)

	return
}
Esempio n. 2
0
func (shape *Shape) Update() {
	//fmt.Println("Rot", shape.Body.rot)
	shape.BB = shape.ShapeClass.update(transform.NewTransform(shape.Body.p, shape.Body.a))
}