Support orient/rotate towards other points
This commit is contained in:
parent
6dc6b5d8e9
commit
d23bd71b7a
4 changed files with 39 additions and 15 deletions
|
@ -66,4 +66,10 @@ module.exports = class Point {
|
|||
let rect = u.rect(size, size, [-size/2, -size/2])
|
||||
return this.position(rect)
|
||||
}
|
||||
|
||||
angle(other) {
|
||||
const dx = other.x - this.x
|
||||
const dy = other.y - this.y
|
||||
return -Math.atan2(dx, dy) * (180 / Math.PI)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue