Ejemplo n.º 1
0
func main() {
	v1 := go4game.Vector3D{0, 0, 0}
	v2 := go4game.Vector3D{1, -1, 1}
	d8 := v1.To8Direct(v2)
	fmt.Printf("%v %v %v\n", v1, v2, d8)
	hr := go4game.HyperRect{
		go4game.Vector3D{-10, -10, -10},
		go4game.Vector3D{10, 10, 10},
	}
	nhr := hr.MakeCubeBy8Driect(v1, d8)
	fmt.Printf("%v %v %v isin %v\n", hr, nhr, d8, v2.IsIn(nhr))

}
Ejemplo n.º 2
0
func (a *AIAdv) AimAdjedIntoCube(estpos *go4game.Vector3D, o *SPObj, bulletType GameObjectType) *go4game.Vector3D {
	if !estpos.IsIn(GameConst.WorldCube2) && o.ObjType != GameObjMain {
		return nil
	}
	lenori := a.me.PosVector.LenTo(*estpos)
	if o.ObjType == GameObjMain {
		changed := estpos.MakeIn(GameConst.WorldCube)
		if changed != 0 {
			//log.Printf("target %v bounce %b", o.ID, changed)
		}
	}
	lennew := a.me.PosVector.LenTo(*estpos)
	lenrate := lennew / lenori
	vt := estpos.Sub(a.me.PosVector).NormalizedTo(GameConst.MoveLimit[bulletType]).Imul(lenrate)
	return &vt
}