I am using the google maps api for an android game that 开发者_StackOverflowincorporates the players movement in the real world. I have figured out how to make markers indicating where something would be on the map, but I would like to keep a fixed map zoom level and have off-screen markers show up as arrows on the screen.
Anyone know of a way inside of the map API to do this without having to explicitly figuring out the angle to the object and rotating an arrow icon to point in that direction.
I don't have experience of the Google API, but from a simple point of view if you know the current location and the marker location couldn't you just use some simple vector maths to calculate the heading and, therefore, the arrow heading?
i.e.
MarkerPosition - CurrentPosition = TargetVector
TargetVector.normalize()
精彩评论