2013-09-28 09:44:47 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bitbucket.org/hackerbots/vector"
|
|
|
|
)
|
|
|
|
|
2013-10-19 00:00:45 -07:00
|
|
|
func move(d1, d2 govector.Point2d, velocity float32, timeDelta float32) govector.Point2d {
|
2013-09-28 09:44:47 -07:00
|
|
|
v := d2.Sub(d1)
|
|
|
|
v_norm := v.Normalize()
|
|
|
|
v_scaled := v_norm.Scale(velocity * timeDelta)
|
|
|
|
return d1.Add(v_scaled)
|
|
|
|
}
|